Skip to content

Commit b6093a5

Browse files
robfitz273kJunio C Hamano
authored andcommitted
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>
1 parent 5ad6608 commit b6093a5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

gitweb/gitweb.perl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4483,11 +4483,7 @@ sub git_feed {
44834483

44844484
# log/feed of current (HEAD) branch, log of given branch, history of file/directory
44854485
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);
44914487

44924488
my %latest_commit;
44934489
my %latest_date;
@@ -4497,8 +4493,8 @@ sub git_feed {
44974493
# browser (feed reader) prefers text/xml
44984494
$content_type = 'text/xml';
44994495
}
4500-
if (defined($revlist[0])) {
4501-
%latest_commit = parse_commit($revlist[0]);
4496+
if (defined($commitlist[0])) {
4497+
%latest_commit = %{$commitlist[0]};
45024498
%latest_date = parse_date($latest_commit{'author_epoch'});
45034499
print $cgi->header(
45044500
-type => $content_type,
@@ -4588,17 +4584,17 @@ sub git_feed {
45884584
}
45894585

45904586
# 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'};
45944590
# we read 150, we always show 30 and the ones more recent than 48 hours
45954591
if (($i >= 20) && ((time - $co{'author_epoch'}) > 48*60*60)) {
45964592
last;
45974593
}
45984594
my %cd = parse_date($co{'author_epoch'});
45994595

46004596
# 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,
46024598
$co{'parent'}, $co{'id'}, "--", (defined $file_name ? $file_name : ())
46034599
or next;
46044600
my @difftree = map { chomp; $_ } <$fd>;

0 commit comments

Comments
 (0)