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

gitweb: Change atom, rss actions to use parse_commits.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Robert Fitzsimons committed Dec 24, 2006 at 14:31 UTC b6093a5c02f6dd16dadcc0e9caa1e0e76216f929
1 file changed +7 -11
gitweb/gitweb.perl
+7 -11
@@ -4483,11 +4483,7 @@ sub git_feed {
4483
4484 # log/feed of current (HEAD) branch, log of given branch, history of file/directory
4485 my $head = $hash || 'HEAD';
4486 - open my $fd, "-|", git_cmd(), "rev-list", "--max-count=150",
4487 - $head, "--", (defined $file_name ? $file_name : ())
4488 - or die_error(undef, "Open git-rev-list failed");
4489 - my @revlist = map { chomp; $_ } <$fd>;
4490 - close $fd or die_error(undef, "Reading git-rev-list failed");
4486 + my @commitlist = parse_commits($head, 150);
4487
4488 my %latest_commit;
4489 my %latest_date;
@@ -4497,8 +4493,8 @@ sub git_feed {
4493 # browser (feed reader) prefers text/xml
4494 $content_type = 'text/xml';
4495 }
4500 - if (defined($revlist[0])) {
4501 - %latest_commit = parse_commit($revlist[0]);
4496 + if (defined($commitlist[0])) {
4497 + %latest_commit = %{$commitlist[0]};
4498 %latest_date = parse_date($latest_commit{'author_epoch'});
4499 print $cgi->header(
4500 -type => $content_type,
@@ -4588,9 +4584,9 @@ XML
4584 }
4585
4586 # contents
4591 - for (my $i = 0; $i <= $#revlist; $i++) {
4592 - my $commit = $revlist[$i];
4593 - my %co = parse_commit($commit);
4587 + for (my $i = 0; $i <= $#commitlist; $i++) {
4588 + my %co = %{$commitlist[$i]};
4589 + my $commit = $co{'id'};
4590 # we read 150, we always show 30 and the ones more recent than 48 hours
4591 if (($i >= 20) && ((time - $co{'author_epoch'}) > 48*60*60)) {
4592 last;
@@ -4598,7 +4594,7 @@ XML
4594 my %cd = parse_date($co{'author_epoch'});
4595
4596 # get list of changed files
4601 - open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
4597 + open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
4598 $co{'parent'}, $co{'id'}, "--", (defined $file_name ? $file_name : ())
4599 or next;
4600 my @difftree = map { chomp; $_ } <$fd>;