aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2016-03-14 13:02:06 +0000
committerEric S. Raymond <esr@thyrsus.com>2016-03-14 13:02:06 +0000
commit6bd2571ac1ae6e5e3ebf3662f3eabb75f08e7605 (patch)
treed8d8416ebca4756d5a73c497e47ddb337c62fe0e
parentRemove some irclib remnants. (diff)
parentAlso shorten the commit used for the standard webview urls (diff)
downloadirker-6bd2571ac1ae6e5e3ebf3662f3eabb75f08e7605.tar.xz
Merge branch 'use_abbreviated_hash_for_short_format' into 'master'
Use abbreviated hash for short format Use git log's '%h' to get the abbreviated hash for the commit. Fixes issue #7 See merge request !6
-rwxr-xr-xirkerhook.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/irkerhook.py b/irkerhook.py
index 33a4c52..1482200 100755
--- a/irkerhook.py
+++ b/irkerhook.py
@@ -281,7 +281,11 @@ class GitExtractor(GenericExtractor):
else: # self.revformat == 'describe'
commit.rev = do("git describe %s 2>/dev/null" % shellquote(commit.commit))
if not commit.rev:
- commit.rev = commit.commit[:12]
+ # Query git for the abbreviated hash
+ commit.rev = do("git log -1 '--pretty=format:%h' " + shellquote(commit.commit))
+ if self.urlprefix in ('gitweb', 'cgit'):
+ # Also truncate the commit used for the announced urls
+ commit.commit = commit.rev
# Extract the meta-information for the commit
commit.files = do("git diff-tree -r --name-only " + shellquote(commit.commit))
commit.files = " ".join(commit.files.strip().split("\n")[1:])