From b30a71222eaf5ca9768919e730bafac7f4366a2a Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 1 Mar 2018 17:31:30 +0200 Subject: [PATCH] Remove second reference to branch This fixes a problem in repos that lack a head branch. PR: #8 --- src/gitoper.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gitoper.py b/src/gitoper.py index 3e4c18b..4d2b324 100644 --- a/src/gitoper.py +++ b/src/gitoper.py @@ -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):