Add git.clone and git.checkout states

This commit is contained in:
garrettmills
2020-03-05 11:48:38 -06:00
parent 904a4be1b1
commit 9dc6f9d214
5 changed files with 97 additions and 1 deletions

View File

@@ -62,6 +62,20 @@ class Repository extends Injectable {
await this._git_cmd(`checkout "${ref}"`)
}
async current_branch() {
const cd_cmd = await this._host.get_directory_change_command(this._path)
const cmd = `${cd_cmd} && git symbolic-ref HEAD`
const full_ref = await this._host.run_line_result(cmd)
return full_ref.replace('refs/heads/', '')
}
async current_ref() {
const cd_cmd = await this._host.get_directory_change_command(this._path)
const cmd = `${cd_cmd} && git show-ref HEAD`
const ref = await this._host.run_line_result(cmd)
return ref.split(' ')[0]
}
async stash() {
await this._git_cmd(`stash`)
}