Add git.tag state; abstract out AbstractGitState class

This commit is contained in:
garrettmills
2020-03-05 12:15:00 -06:00
parent 9dc6f9d214
commit a6c0b5884a
6 changed files with 61 additions and 19 deletions

View File

@@ -50,10 +50,20 @@ class Repository extends Injectable {
await this._git_cmd(`commit -m "${message}"`)
}
async tag(label) {
async create_tag(label) {
await this._git_cmd(`tag "${label}"`)
}
async delete_tag(label) {
await this._git_cmd(`tag --delete "${label}"`)
}
async get_tag(label) {
const cd_cmd = await this._host.get_directory_change_command(this._path)
const cmd = `${cd_cmd} && git rev-parse "${label}"`
return await this._host.run_line_result(cmd)
}
async push(target = false, ref = false) {
await this._git_cmd(`push${target ? ' '+target : ''}${ref ? ' '+ref : ''} --tags`)
}