git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 6/7] gitweb: Assume parsed revision list in git_shortlog_body and git_history_body

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 6, 2006, 13:08 UTC
Message-ID
<11575480922345-git-send-email-jnareb@gmail.com>
In-Reply-To
<11575480921279-git-send-email-jnareb@gmail.com>

Assume that git_shortlog and git_history uses parse_rev_list subroutine, and git_shortlog_body and git_history_body gets parsed revision list as a parameter.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   35 ++++++++++++-----------------------
 1 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e665d94..be4db08 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1943,21 +1943,19 @@ sub git_shortlog_body {
 	print "<table class=\"shortlog\" cellspacing=\"0\">\n";
 	my $alternate = 0;
 	for (my $i = $from; $i <= $to; $i++) {
-		my $commit = $revlist->[$i];
-		#my $ref = defined $refs ? format_ref_marker($refs, $commit) : '';
+		my $co = $revlist->[$i];
+		my $commit = $co->{'id'};
 		my $ref = format_ref_marker($refs, $commit);
-		my %co = ref $commit ? %$commit : parse_commit($commit);
 		if ($alternate) {
 			print "<tr class=\"dark\">\n";
 		} else {
 			print "<tr class=\"light\">\n";
 		}
 		$alternate ^= 1;
-		# git_summary() used print "<td><i>$co{'age_string'}</i></td>\n" .
-		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-		      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
+		print "<td title=\"$co->{'age_string_age'}\"><i>$co->{'age_string_date'}</i></td>\n" .
+		      "<td><i>" . esc_html(chop_str($co->{'author_name'}, 10)) . "</i></td>\n" .
 		      "<td>";
-		print format_subject_html($co{'title'}, $co{'title_short'},
+		print format_subject_html($co->{'title'}, $co->{'title_short'},
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
@@ -1987,17 +1985,8 @@ sub git_history_body {
 	print "<table class=\"history\" cellspacing=\"0\">\n";
 	my $alternate = 0;
 	for (my $i = $from; $i <= $to; $i++) {
-		if (ref($revlist->[$i]) ne "HASH" &&
-		    $revlist->[$i] !~ m/^([0-9a-fA-F]{40})/) {
-			next;
-		}
-
-		my $commit = $1;
-		my %co = ref $commit ? %$commit : parse_commit($commit);
-		if (!%co) {
-			next;
-		}
-
+		my $co = $revlist->[$i];
+		my $commit = $co->{'id'};
 		my $ref = format_ref_marker($refs, $commit);
 
 		if ($alternate) {
@@ -2006,12 +1995,12 @@ sub git_history_body {
 			print "<tr class=\"light\">\n";
 		}
 		$alternate ^= 1;
-		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-		      # shortlog uses      chop_str($co{'author_name'}, 10)
-		      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
+		print "<td title=\"$co->{'age_string_age'}\"><i>$co->{'age_string_date'}</i></td>\n" .
+		      # shortlog uses      chop_str($co->{'author_name'}, 10)
+		      "<td><i>" . esc_html(chop_str($co->{'author_name'}, 15, 3)) . "</i></td>\n" .
 		      "<td>";
-		# originally git_history used chop_str($co{'title'}, 50)
-		print format_subject_html($co{'title'}, $co{'title_short'},
+		# originally git_history used chop_str($co->{'title'}, 50)
+		print format_subject_html($co->{'title'}, $co->{'title_short'},
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
-- 
1.4.2
Previous: Jakub NarebskiNext: Jakub Narebski
Message 7 of 28 in “gitweb: Trying to improve history view speed”
  1. 0/7 gitweb: Trying to improve history view speedJakub Narebski, Sep 6, 2006
  2. 1/7 gitweb: Make pickaxe search a featureJakub Narebski, Sep 6, 2006
  3. 2/7 gitweb: Paginate history outputJakub Narebski, Sep 6, 2006
  4. 3/7 gitweb: Use @hist_opts as git-rev-list parameters in git_historyJakub Narebski, Sep 6, 2006
  5. 4/7 gitweb: Add parse_rev_list for later useJakub Narebski, Sep 6, 2006
  6. 5/7 gitweb: Use parse_rev_list in git_shortlog and git_historyJakub Narebski, Sep 6, 2006
  7. 6/7 gitweb: Assume parsed revision list in git_shortlog_body and git_history_bodyJakub Narebski, Sep 6, 2006
  8. 7/7 gitweb: Set page to 0 if it is not defined, in git_historyJakub Narebski, Sep 6, 2006
  9. 8/8 gitweb: Remove --parents from call to git-rev-list in parse_rev_listJakub Narebski, Sep 6, 2006
  10. Linus TorvaldsSep 6, 2006
  11. Jakub NarebskiSep 6, 2006
  12. Junio C HamanoSep 6, 2006
  13. Jakub NarebskiSep 6, 2006
  14. Jakub NarebskiSep 7, 2006
  15. Junio C HamanoSep 7, 2006
  16. Jakub NarebskiSep 7, 2006
  17. Junio C HamanoSep 7, 2006
  18. Jakub NarebskiSep 7, 2006
  19. Linus TorvaldsSep 6, 2006
  20. Jakub NarebskiSep 6, 2006
  21. Linus TorvaldsSep 6, 2006
  22. Jakub NarebskiSep 6, 2006
  23. Linus TorvaldsSep 6, 2006
  24. Junio C HamanoSep 6, 2006
  25. Jakub NarebskiSep 9, 2006
  26. Junio C HamanoSep 9, 2006
  27. Jakub NarebskiSep 9, 2006
  28. Junio C HamanoSep 9, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.