Skip to content

Commit

Permalink
gitweb: only display "next" links in logs if there is a next page
Browse files Browse the repository at this point in the history
There was a bug in the implementation of the "next" links in
format_paging_nav (for log and shortlog), which caused the next links
to always be displayed, even if there is no next page.  This fixes it.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Lea Wiemann authored and Junio C Hamano committed May 28, 2008
1 parent a17171b commit 1f684dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2676,7 +2676,7 @@ sub git_print_page_nav {
}

sub format_paging_nav {
my ($action, $hash, $head, $page, $nrevs) = @_;
my ($action, $hash, $head, $page, $has_next_link) = @_;
my $paging_nav;


Expand All @@ -2694,7 +2694,7 @@ sub format_paging_nav {
$paging_nav .= " &sdot; prev";
}

if ($nrevs >= (100 * ($page+1)-1)) {
if ($has_next_link) {
$paging_nav .= " &sdot; " .
$cgi->a({-href => href(-replay=>1, page=>$page+1),
-accesskey => "n", -title => "Alt-n"}, "next");
Expand Down Expand Up @@ -4585,7 +4585,7 @@ sub git_log {

my @commitlist = parse_commits($hash, 101, (100 * $page));

my $paging_nav = format_paging_nav('log', $hash, $head, $page, (100 * ($page+1)));
my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);

git_header_html();
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
Expand Down Expand Up @@ -5505,7 +5505,7 @@ sub git_shortlog {

my @commitlist = parse_commits($hash, 101, (100 * $page));

my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, (100 * ($page+1)));
my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);
my $next_link = '';
if ($#commitlist >= 100) {
$next_link =
Expand Down

0 comments on commit 1f684dc

Please sign in to comment.