提交 ccb04f99 编写于 作者: J Jakub Narebski 提交者: Junio C Hamano

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: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: NJakub Narebski <jnareb@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 621f1b4b
......@@ -1364,7 +1364,7 @@ sub format_log_line_html {
my $line = shift;
$line = esc_html($line, -nbsp=>1);
if ($line =~ m/([0-9a-fA-F]{8,40})/) {
if ($line =~ m/\b([0-9a-fA-F]{8,40})\b/) {
my $hash_text = $1;
my $link =
$cgi->a({-href => href(action=>"object", hash=>$hash_text),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册