From: Junio C Hamano Date: Sat, 1 Jul 2006 01:54:32 +0000 (-0700) Subject: gitweb: optimize per-file history generation X-Git-Tag: v1.4.2-rc1~81^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cdd4037d7053647c97139ac77d4319124f17d47e;p=git.git gitweb: optimize per-file history generation 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 --- diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 035e76d0a..100774215 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -2295,16 +2295,13 @@ sub git_history { "\n"; print "
/" . esc_html($file_name) . "
\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 "\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 "\n" . "\n"; - undef $commit; } } print "
\n";