Skip to content

Commit 9ffe88e

Browse files
committed
gitpython: wrap exceptions in active_branch
1 parent 4f33b35 commit 9ffe88e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scmrepo/git/backend/gitpython.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ def is_dirty(self, untracked_files: bool = False) -> bool:
293293
return self.repo.is_dirty(untracked_files=untracked_files)
294294

295295
def active_branch(self):
296-
return self.repo.active_branch.name
296+
try:
297+
return self.repo.active_branch.name
298+
except TypeError as exc:
299+
raise SCMError("No active branch") from exc
297300

298301
def list_branches(self):
299302
return [h.name for h in self.repo.heads]

0 commit comments

Comments
 (0)