summaryrefslogtreecommitdiff
path: root/scripts/check-copyright-year
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-03-19 17:15:27 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-03-19 17:15:27 +0000
commit08d0ac23634bcbeb15b709827dfa58f9d9947ca7 (patch)
treee2bad1034b62fa40020186fac05fc7c0812bac8f /scripts/check-copyright-year
parent7752ce569c9b748a93f50db8661c4f862869226d (diff)
downloadmorph-08d0ac23634bcbeb15b709827dfa58f9d9947ca7.tar.gz
check: fix copyright script for merge commits
The last commit of a file can be a merge Merge commits have their date on a different line because it displays information about which branches merged Instead of relying on this fragile 'porcelain' format, specify that we only want the last commit's committer date and split the year from that output
Diffstat (limited to 'scripts/check-copyright-year')
-rwxr-xr-xscripts/check-copyright-year8
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/check-copyright-year b/scripts/check-copyright-year
index a2521102..2fed252e 100755
--- a/scripts/check-copyright-year
+++ b/scripts/check-copyright-year
@@ -62,11 +62,9 @@ class CheckCopyrightYear(cliapp.Application):
self.all_ok = self.all_ok and ok
def get_git_commit_year(self, filename):
- out = self.runcmd(['git', 'log', filename])
- lines = out.splitlines()
- assert lines[2].startswith('Date:')
- words = lines[2].split()
- return int(words[5])
+ out = self.runcmd(['git', 'log', '-1', '--format=format:%cd', filename])
+ words = out.split()
+ return int(words[4])
def get_copyright_years(self, match):
years = match.group('years')