gitweb: Change log action to use parse_commits.
Also add missing next link to bottom of page. 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
719dad28c599dc2e2917c3cb0e44152fd92bf133
1 file changed
+14
-11
gitweb/gitweb.perl
+14
-11
@@ -3645,28 +3645,25 @@ sub git_log {
3645
}
3646
my $refs = git_get_references();
3647
3648
- my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
3649
- open my $fd, "-|", git_cmd(), "rev-list", $limit, $hash, "--"
3650
- or die_error(undef, "Open git-rev-list failed");
3651
- my @revlist = map { chomp; $_ } <$fd>;
3652
- close $fd;
3648
+ my @commitlist = parse_commits($hash, 101, (100 * $page));
3649
3654
- my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#revlist);
3650
+ my $paging_nav = format_paging_nav('log', $hash, $head, $page, (100 * ($page+1)));
3651
3652
git_header_html();
3653
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
3654
3659
- if (!@revlist) {
3655
+ if (!@commitlist) {
3656
my %co = parse_commit($hash);
3657
3658
git_print_header_div('summary', $project);
3659
print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n";
3660
}
3665
- for (my $i = ($page * 100); $i <= $#revlist; $i++) {
3666
- my $commit = $revlist[$i];
3667
- my $ref = format_ref_marker($refs, $commit);
3668
- my %co = parse_commit($commit);
3661
+ my $to = ($#commitlist >= 99) ? (99) : ($#commitlist);
3662
+ for (my $i = 0; $i <= $to; $i++) {
3663
+ my %co = %{$commitlist[$i]};
3664
next if !%co;
3665
+ my $commit = $co{'id'};
3666
+ my $ref = format_ref_marker($refs, $commit);
3667
my %ad = parse_date($co{'author_epoch'});
3668
git_print_header_div('commit',
3669
"<span class=\"age\">$co{'age_string'}</span>" .
@@ -3688,6 +3685,12 @@ sub git_log {
3685
git_print_log($co{'comment'}, -final_empty_line=> 1);
3686
print "</div>\n";
3687
}
3688
+ if ($#commitlist >= 100) {
3689
+ print "<div class=\"page_nav\">\n";
3690
+ print $cgi->a({-href => href(action=>"log", hash=>$hash, page=>$page+1),
3691
+ -accesskey => "n", -title => "Alt-n"}, "next");
3692
+ print "</div>\n";
3693
+ }
3694
git_footer_html();
3695
}
3696