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

[PATCH 6/8] gitweb: Change atom, rss actions to use parse_commits.

From
RFRobert Fitzsimons <robfitz@273k.net>
Date
Dec 24, 2006, 14:31 UTC
Message-ID
<1166970711394-git-send-email-robfitz@273k.net>
In-Reply-To
<116697071140-git-send-email-robfitz@273k.net>
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 gitweb/gitweb.perl |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 53dd225..f752a6f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4483,11 +4483,7 @@ sub git_feed {
 
 	# log/feed of current (HEAD) branch, log of given branch, history of file/directory
 	my $head = $hash || 'HEAD';
-	open my $fd, "-|", git_cmd(), "rev-list", "--max-count=150",
-		$head, "--", (defined $file_name ? $file_name : ())
-		or die_error(undef, "Open git-rev-list failed");
-	my @revlist = map { chomp; $_ } <$fd>;
-	close $fd or die_error(undef, "Reading git-rev-list failed");
+	my @commitlist = parse_commits($head, 150);
 
 	my %latest_commit;
 	my %latest_date;
@@ -4497,8 +4493,8 @@ sub git_feed {
 		# browser (feed reader) prefers text/xml
 		$content_type = 'text/xml';
 	}
-	if (defined($revlist[0])) {
-		%latest_commit = parse_commit($revlist[0]);
+	if (defined($commitlist[0])) {
+		%latest_commit = %{$commitlist[0]};
 		%latest_date   = parse_date($latest_commit{'author_epoch'});
 		print $cgi->header(
 			-type => $content_type,
@@ -4588,9 +4584,9 @@ XML
 	}
 
 	# contents
-	for (my $i = 0; $i <= $#revlist; $i++) {
-		my $commit = $revlist[$i];
-		my %co = parse_commit($commit);
+	for (my $i = 0; $i <= $#commitlist; $i++) {
+		my %co = %{$commitlist[$i]};
+		my $commit = $co{'id'};
 		# we read 150, we always show 30 and the ones more recent than 48 hours
 		if (($i >= 20) && ((time - $co{'author_epoch'}) > 48*60*60)) {
 			last;
@@ -4598,7 +4594,7 @@ XML
 		my %cd = parse_date($co{'author_epoch'});
 
 		# get list of changed files
-		open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
+		open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
 			$co{'parent'}, $co{'id'}, "--", (defined $file_name ? $file_name : ())
 			or next;
 		my @difftree = map { chomp; $_ } <$fd>;
-- 
1.4.4.3.ge655-dirty
Previous: Robert FitzsimonsNext: Robert Fitzsimons
Message 6 of 10 in “gitweb: Add parse_commits, used to bulk load commit objects.”
  1. 1/8 gitweb: Add parse_commits, used to bulk load commit objects.Robert Fitzsimons, Dec 24, 2006
  2. 2/8 gitweb: We do longer need the --parents flag in rev-list.Robert Fitzsimons, Dec 24, 2006
  3. 3/8 gitweb: Change summary, shortlog actions to use parse_commits.Robert Fitzsimons, Dec 24, 2006
  4. 4/8 gitweb: Change log action to use parse_commits.Robert Fitzsimons, Dec 24, 2006
  5. 5/8 gitweb: Change header search action to use parse_commits.Robert Fitzsimons, Dec 24, 2006
  6. 6/8 gitweb: Change atom, rss actions to use parse_commits.Robert Fitzsimons, Dec 24, 2006
  7. 7/8 gitweb: Change history action to use parse_commits.Robert Fitzsimons, Dec 24, 2006
  8. 8/8 gitweb: Use rev-list --skip option.Robert Fitzsimons, Dec 24, 2006
  9. Jakub NarebskiDec 25, 2006
  10. gitweb: Re-enable rev-list --parents for parse_commit.Robert Fitzsimons, Dec 27, 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.