@matheusbsbs / matheus-bagliano / commits / cdd4037d70
Fork 0

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>

Junio C Hamano committed Jun 30, 2006 at 18:54 UTC cdd4037d7053647c97139ac77d4319124f17d47e
1 file changed +3 -7
gitweb/gitweb.cgi
+3 -7
@@ -2295,16 +2295,13 @@ sub git_history {
2295 "</div>\n";
2296 print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
2297
2298 - open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -- \'$file_name\'";
2299 - my $commit;
2298 + open my $fd, "-|",
2299 + "$gitbin/git-rev-list --full-history $hash -- \'$file_name\'";
2300 print "<table cellspacing=\"0\">\n";
2301 my $alternate = 0;
2302 while (my $line = <$fd>) {
2303 if ($line =~ m/^([0-9a-fA-F]{40})/){
2304 - $commit = $1;
2305 - next;
2306 - }
2307 - if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ && (defined $commit)) {
2304 + my $commit = $1;
2305 my %co = git_read_commit($commit);
2306 if (!%co) {
2307 next;
@@ -2336,7 +2333,6 @@ sub git_history {
2333 }
2334 print "</td>\n" .
2335 "</tr>\n";
2339 - undef $commit;
2336 }
2337 }
2338 print "</table>\n";