1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 06:25:13 +01:00

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 <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-06-30 18:54:32 -07:00
parent 0556a11a0d
commit b00d7079ce

View file

@ -2295,16 +2295,13 @@ sub git_history {
"</div>\n"; "</div>\n";
print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></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\'"; open my $fd, "-|",
my $commit; "$gitbin/git-rev-list --full-history $hash -- \'$file_name\'";
print "<table cellspacing=\"0\">\n"; print "<table cellspacing=\"0\">\n";
my $alternate = 0; my $alternate = 0;
while (my $line = <$fd>) { while (my $line = <$fd>) {
if ($line =~ m/^([0-9a-fA-F]{40})/){ if ($line =~ m/^([0-9a-fA-F]{40})/){
$commit = $1; my $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 %co = git_read_commit($commit); my %co = git_read_commit($commit);
if (!%co) { if (!%co) {
next; next;
@ -2336,7 +2333,6 @@ sub git_history {
} }
print "</td>\n" . print "</td>\n" .
"</tr>\n"; "</tr>\n";
undef $commit;
} }
} }
print "</table>\n"; print "</table>\n";