diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 14:39:40 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 14:39:40 +0000 |
commit | 8029b45dfc9ba8970e57ec0b16d48e2ec1a0bd1a (patch) | |
tree | 4cf145604f3334bc745ed2167f1b0ac0c3a8ee10 | |
parent | 7a4351f3de0ac9877d33b3dd5830039edaa10a25 (diff) | |
download | morph-8029b45dfc9ba8970e57ec0b16d48e2ec1a0bd1a.tar.gz |
Fix copyright year checking in ./check to not fail with uncommitted files
-rwxr-xr-x | scripts/check-copyright-year | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/check-copyright-year b/scripts/check-copyright-year index beaca2ce..f77d3459 100755 --- a/scripts/check-copyright-year +++ b/scripts/check-copyright-year @@ -44,6 +44,12 @@ class CheckCopyrightYear(cliapp.Application): return year = self.get_git_commit_year(filename) + if year is None: + # git does not have a commit date for the file, which might + # happen if the file isn't committed yet. This happens during + # development, and it's OK. It's not quite a lumberjack, but + # let's not get into gender stereotypes here. + return ok = False for start, end in self.get_copyright_years(m): @@ -64,6 +70,8 @@ class CheckCopyrightYear(cliapp.Application): def get_git_commit_year(self, filename): out = self.runcmd(['git', 'log', '-1', '--format=format:%cd', filename]) + if not out: + return None words = out.split() return int(words[4]) |