]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: link to "git describe"'d commits in log messages
[Gitweb] / gitweb.perl
index 61ee84c615e0158a7ba03c8b54bba5d3876b1ff06fa8e883964159c26afcd074..1e0af11a04eb4c3a0ebe2b0d12f080659ba9d43404dc21d4182caa9bca8bf162 100755 (executable)
@@ -2037,10 +2037,24 @@ 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
+        (
+            # The output of "git describe", e.g. v2.10.0-297-gf6727b0
+            # or hadoop-20160921-113441-20-g094fb7d
+            (?<!-) # see strbuf_check_tag_ref(). Tags can't start with -
+            [A-Za-z0-9.-]+
+            (?!\.) # refs can't end with ".", see check_refname_format()
+            -g[0-9a-fA-F]{7,40}
+            |
+            # Just a normal looking Git SHA1
+            [0-9a-fA-F]{7,40}
+        )
+        \b
+    }{
                $cgi->a({-href => href(action=>"object", hash=>$1),
                                        -class => "text"}, $1);
-       }eg;
+       }egx;
 
        return $line;
 }
This page took 0.192625 seconds and 4 git commands to generate.