Skip to content

Commit

Permalink
Remove second reference to branch
Browse files Browse the repository at this point in the history
This fixes a problem in repos that lack a head branch.
PR: #8
  • Loading branch information
dspinellis committed Mar 1, 2018
1 parent 7a0f674 commit b30a712
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/gitoper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,9 @@ def _last_year(self):
"""
Returns the year of the repo's last commit
"""
most_recent_branch = self.cached_command(['branch', '-a',
'--sort=-committerdate']).splitlines()[0]
# Remote leading * (for HEAD) and spaces
most_recent_branch = re.sub(r'^\*?\s+', r'', most_recent_branch)
return int(self.cached_command(['log', '-n', '1',
return int(self.cached_command(['log', '-n', '1', '--all',
'--date=format:%Y',
'--pretty=%ad',
most_recent_branch]
'--pretty=%ad']
))

def refs(self, refs):
Expand Down

0 comments on commit b30a712

Please sign in to comment.