All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Fitzsimons <robfitz@273k.net>
To: git@vger.kernel.org
Cc: Robert Fitzsimons <robfitz@273k.net>
Subject: [PATCH 6/8] gitweb: Change atom, rss actions to use parse_commits.
Date: Sun, 24 Dec 2006 14:31:47 +0000	[thread overview]
Message-ID: <1166970711394-git-send-email-robfitz@273k.net> (raw)
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

  reply	other threads:[~2006-12-24 14:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-24 14:31 [PATCH 1/8] gitweb: Add parse_commits, used to bulk load commit objects Robert Fitzsimons
2006-12-24 14:31 ` [PATCH 2/8] gitweb: We do longer need the --parents flag in rev-list Robert Fitzsimons
2006-12-24 14:31   ` [PATCH 3/8] gitweb: Change summary, shortlog actions to use parse_commits Robert Fitzsimons
2006-12-24 14:31     ` [PATCH 4/8] gitweb: Change log action " Robert Fitzsimons
2006-12-24 14:31       ` [PATCH 5/8] gitweb: Change header search " Robert Fitzsimons
2006-12-24 14:31         ` Robert Fitzsimons [this message]
2006-12-24 14:31           ` [PATCH 7/8] gitweb: Change history " Robert Fitzsimons
2006-12-24 14:31             ` [PATCH 8/8] gitweb: Use rev-list --skip option Robert Fitzsimons
2006-12-25 22:49   ` [PATCH 2/8] gitweb: We do longer need the --parents flag in rev-list Jakub Narebski
2006-12-27 14:22     ` [PATCH] gitweb: Re-enable rev-list --parents for parse_commit Robert Fitzsimons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1166970711394-git-send-email-robfitz@273k.net \
    --to=robfitz@273k.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.