Skip to content

Commit

Permalink
fix 0 commit id for git repos
Browse files Browse the repository at this point in the history
  • Loading branch information
PH111P committed Sep 25, 2024
1 parent 7bbf22b commit 9e81a47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions powerline/lib/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,16 @@ def do_ahead_behind(self):
repo = self._repo()

try:
res = repo.ahead_behind(repo.head.target, repo.revparse_single('@{upstream}').hex)
res = repo.ahead_behind(repo.head.target,
repo.revparse_single('@{upstream}').id)
except KeyError:
res = (0, 0)
return {'AHEAD': res[0], 'BEHIND': res[1]}

@property
def short(self):
#TODO: Don't fix the length of the prefix
return self._repo().head.target.hex[:7]
return self._repo().head.target.__str__()[:7]

@property
def summary(self):
Expand Down

0 comments on commit 9e81a47

Please sign in to comment.