mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
utils: git_get_branch(): check returncode
This commit is contained in:
parent
0c70d6ec59
commit
1275557d71
1 changed files with 2 additions and 0 deletions
2
utils.py
2
utils.py
|
@ -81,6 +81,8 @@ def git(cmd: list[str], dir: Optional[str] = None, capture_output=False, user: O
|
|||
|
||||
def git_get_branch(path) -> str:
|
||||
result = git(['branch', '--show-current'], dir=path, capture_output=True)
|
||||
if result.returncode:
|
||||
raise Exception(f'Error getting git branch for {path}')
|
||||
return result.stdout.decode().strip()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue