gitweb: Better regexp for SHA-1 committag match
Make SHA-1 regexp to be turned into hyperlink (the SHA-1 committag) to match word boundary at the beginning and the end. This way we reduce number of false matches, for example we now don't match 0x74a5cd01 which is hex decimal (for example memory address), but is not SHA-1. Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Feb 6, 2009 at 10:12 UTC
ccb04f99fe3858bae0f06fc7aeefc4d53fec1352
1 file changed
+1
-1
gitweb/gitweb.perl
+1
-1
@@ -1364,7 +1364,7 @@ sub format_log_line_html {
1364
my $line = shift;
1365
1366
$line = esc_html($line, -nbsp=>1);
1367
- if ($line =~ m/([0-9a-fA-F]{8,40})/) {
1367
+ if ($line =~ m/\b([0-9a-fA-F]{8,40})\b/) {
1368
my $hash_text = $1;
1369
my $link =
1370
$cgi->a({-href => href(action=>"object", hash=>$hash_text),