diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2016-10-06 09:11:34 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-14 13:22:51 -0700 |
commit | 8059966cc41350188718257f5363d601a83aaee7 (patch) | |
tree | 3a76dff6cbf97c8f2539c51351727155bbdf21e3 /gitweb/gitweb.perl | |
parent | 26547bfb2b8098995b2a67770e96f29fafb11318 (diff) | |
download | git-8059966cc41350188718257f5363d601a83aaee7.tar.gz git-8059966cc41350188718257f5363d601a83aaee7.tar.xz |
gitweb: link to 7-char+ SHA-1s, not only 8-char+
Change the minimum length of an abbreviated object identifier in the
commit message gitweb tries to turn into link from 8 hexchars to 7.
This arbitrary minimum length of 8 was introduced in bfe2191 ("gitweb:
SHA-1 in commit log message links to "object" view", 2006-12-10), but
the default abbreviation length is 7, and has been for a long time.
It's still possible to reference SHA-1s down to 4 characters in length,
see v1.7.4-1-gdce9648's MINIMUM_ABBREV, but I can't see how to make
git actually produce that, so I doubt anyone is putting that into log
messages in practice, but people definitely do put 7 character SHA-1s
into log messages.
I think it's fairly dubious to link to things matching [0-9a-fA-F]
here as opposed to just [0-9a-f], that dates back to the initial
version of gitweb from 161332a ("first working version",
2005-08-07). Git will accept all-caps SHA-1s, but didn't ever produce
them as far as I can tell.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-x | gitweb/gitweb.perl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 9473daf4c..101dbc079 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2036,7 +2036,7 @@ sub format_log_line_html { my $line = shift; $line = esc_html($line, -nbsp=>1); - $line =~ s{\b([0-9a-fA-F]{8,40})\b}{ + $line =~ s{\b([0-9a-fA-F]{7,40})\b}{ $cgi->a({-href => href(action=>"object", hash=>$1), -class => "text"}, $1); }eg; |