utils: git_get_branch(): check returncode

This commit is contained in:
InsanePrawn 2022-09-22 16:51:23 +02:00
parent 0c70d6ec59
commit 1275557d71

View file

@ -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()