]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: optimize per-file history generation
authorJunio C Hamano <redacted>
Sat, 1 Jul 2006 01:54:32 +0000 (18:54 -0700)
committerLady <redacted>
Sat, 4 Apr 2026 18:43:37 +0000 (14:43 -0400)
The rev-list command that is recent enough can filter commits
based on paths they touch, so use it instead of generating the
full list and limiting it by passing it with diff-tree --stdin.

[jc: The patch originally came from Luben Tuikov but the it was
 corrupt, but it was short enough to be applied by hand.  I
 added the --full-history to make the output compatible with the
 original while doing so.]

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

index b7ea0fd3973019e675753e1e92f81250122f15b3d76ed3f89a7b09982e0572d0..10f8fda2adb3c36866d7165512a5eebe5e65cda70b960f276979b590c1ca5dfb 100755 (executable)
@@ -2295,16 +2295,13 @@ sub git_history {
              "</div>\n";
        print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
 
-       open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -- \'$file_name\'";
-       my $commit;
+       open my $fd, "-|",
+               "$gitbin/git-rev-list --full-history $hash -- \'$file_name\'";
        print "<table cellspacing=\"0\">\n";
        my $alternate = 0;
        while (my $line = <$fd>) {
                if ($line =~ m/^([0-9a-fA-F]{40})/){
-                       $commit = $1;
-                       next;
-               }
-               if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ && (defined $commit)) {
+                       my $commit = $1;
                        my %co = git_read_commit($commit);
                        if (!%co) {
                                next;
@@ -2336,7 +2333,6 @@ sub git_history {
                        }
                        print "</td>\n" .
                              "</tr>\n";
-                       undef $commit;
                }
        }
        print "</table>\n";
This page took 0.247669 seconds and 4 git commands to generate.