mirror of
https://github.com/openSUSE/osc.git
synced 2025-10-23 08:42:15 +02:00
Fix gitea_api.Git.get_branch_head() to raise a proper exception if the HEAD cannot be retrieved
This commit is contained in:
@@ -156,7 +156,10 @@ class Git:
|
||||
if not branch:
|
||||
branch = self.current_branch
|
||||
|
||||
return self._run_git(["rev-parse", f"refs/heads/{branch}"])
|
||||
try:
|
||||
return self._run_git(["rev-parse", f"refs/heads/{branch}"], mute_stderr=True)
|
||||
except subprocess.CalledProcessError:
|
||||
raise exceptions.GitObsRuntimeError(f"Unable to retrieve HEAD from branch '{branch}'. Does the branch exist?")
|
||||
|
||||
def branch_exists(self, branch: str) -> bool:
|
||||
try:
|
||||
|
Reference in New Issue
Block a user