Skip to content

Commit

Permalink
gitweb: Show '...' links in "summary" view only if there are more items
Browse files Browse the repository at this point in the history
Show "..." links in "summary" view to shortlog, heads (if there are
any), and tags (if there are any) only if there are more items to show
than shown already.

This means that "..." link is shown below shortened shortlog if there
are more than 16 commits, "..." link below shortened heads list if
there are more than 16 heads refs (16 branches), "..." link below
shortened tags list if there are more than 16 tags.

Modified patch from Jakub to to apply cleanly to master, also preform
the same "..." link logic to the forks list.

Signed-off-by: Jakub Narebski <[email protected]>
Signed-off-by: Robert Fitzsimons <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
robfitz273k authored and Junio C Hamano committed Dec 20, 2006
1 parent fc1905b commit 313ce8c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2915,8 +2915,10 @@ sub git_summary {
my $owner = git_get_project_owner($project);

my $refs = git_get_references();
my @taglist = git_get_tags_list(15);
my @headlist = git_get_heads_list(15);
# These get_*_list functions return one more to allow us to see if
# there are more ...
my @taglist = git_get_tags_list(16);
my @headlist = git_get_heads_list(16);
my @forklist;
my ($check_forks) = gitweb_check_feature('forks');

Expand Down Expand Up @@ -2952,24 +2954,29 @@ sub git_summary {
}
}

# we need to request one more than 16 (0..15) to check if
# those 16 are all
open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
git_get_head_hash($project), "--"
or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
git_print_header_div('shortlog');
git_shortlog_body(\@revlist, 0, 15, $refs,
$#revlist <= 15 ? undef :
$cgi->a({-href => href(action=>"shortlog")}, "..."));

if (@taglist) {
git_print_header_div('tags');
git_tags_body(\@taglist, 0, 15,
$#taglist <= 15 ? undef :
$cgi->a({-href => href(action=>"tags")}, "..."));
}

if (@headlist) {
git_print_header_div('heads');
git_heads_body(\@headlist, $head, 0, 15,
$#headlist <= 15 ? undef :
$cgi->a({-href => href(action=>"heads")}, "..."));
}

Expand Down

0 comments on commit 313ce8c

Please sign in to comment.