fix: detached head check

This commit is contained in:
Piotr Dec 2026-04-14 02:46:15 +02:00
parent a50df466d0
commit da1292a45f
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0

View file

@ -30,6 +30,8 @@ class GitService:
self._repo.git.checkout(sha)
def get_head(self) -> Head:
if self._repo.head.is_detached:
return Head(self._repo.head.object.hexsha, "detached")
return Head(
self._repo.active_branch.commit.hexsha,
self._repo.active_branch.name