]> Lady’s Gitweb - Gitweb/commitdiff
gitweb.cgi: git_blame2: slight optimization reading the blame lines
authorLuben Tuikov <redacted>
Sun, 23 Jul 2006 21:17:48 +0000 (14:17 -0700)
committerLady <redacted>
Sat, 4 Apr 2026 18:43:37 +0000 (14:43 -0400)
Eliminate git_read_blame_line() -- move that code inline and
optimize it.

Signed-off-by: Luben Tuikov <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.cgi

index f39cad1a3c08f4fe7bbfc1c19f2a84b6a538ade7a37b25c0f52649b46ac7332a..73a2763134389afb856fc127b8794fc856dbd8411515b75c99d71fee07506530 100755 (executable)
@@ -1252,15 +1252,6 @@ sub git_tag {
        git_footer_html();
 }
 
-sub git_read_blame_line {
-       my %bl;
-       $_ = shift;
-
-       ($bl{'hash'}, $bl{'lineno'}, $bl{'data'}) = /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
-
-       return %bl;
-}
-
 sub git_blame2 {
        my $fd;
        my $ftype;
@@ -1302,12 +1293,12 @@ sub git_blame2 {
        print "<div class=\"page_body\">\n";
        print "<table class=\"blame\">\n";
        print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
-       while (my $line = <$fd>) {
-               my %blame_line = git_read_blame_line($line);
-               my $full_rev = $blame_line{'hash'};
+       while (<$fd>) {
+               /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
+               my $full_rev = $1;
                my $rev = substr($full_rev, 0, 8);
-               my $lineno = $blame_line{'lineno'};
-               my $data = $blame_line{'data'};
+               my $lineno = $2;
+               my $data = $3;
 
                if (!defined $last_rev) {
                        $last_rev = $full_rev;
This page took 0.282343 seconds and 4 git commands to generate.