Skip to content

Commit

Permalink
try fixing detached head
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed May 30, 2024
1 parent c3535bd commit 4292698
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions snippets2changelog/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ def repo_root(self) -> Path:
return Path(self._repo.working_dir)

@property
def branch_name(self) -> Head:
return self._repo.active_branch
def branch_name(self) -> str:
try:
return str(self._repo.active_branch)
except Exception as e:
print(f"HEAD is detached: {e}")
return str(self._repo.head.commit.hexsha)

@property
def tags(self) -> list[TagReference]:
Expand Down

0 comments on commit 4292698

Please sign in to comment.