threads / patch / 3491

patch, 2 partsSpeed up history generation

Subject: [PATCH 2/2] Speed up history generation

## tl;dr

One message between Feb 28, 2006 and Feb 28, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Luben Tuikov· Feb 28, 2006, 12:39 UTC · lore
Speed up history generation as suggested by Linus.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb.cgi |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
69d694fccacb09059731abe4918f8f9aa8969690
Show changes to gitweb.cgi +3 −8
diff --git a/gitweb.cgi b/gitweb.cgi
index 452528f..bfea65d 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -2124,16 +2124,12 @@ 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 $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)) {
+	        if ($line =~ m/^([0-9a-fA-F]{40})/){
+			my $commit = $1;
 			my %co = git_read_commit($commit);
 			if (!%co) {
 				next;
@@ -2165,7 +2161,6 @@ sub git_history {
 			}
 			print "</td>\n" .
 			      "</tr>\n";
-			undef $commit;
 		}
 	}
 	print "</table>\n";
-- 
1.2.3.g975a

← back to recent threads