diff options
author | Robert Fitzsimons <robfitz@273k.net> | 2006-12-19 12:08:54 +0000 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-19 22:49:59 -0800 |
commit | 313ce8cee665447e4476d7e8985b270346a8e5a1 (patch) | |
tree | be5b94e3b23e172abac69c888a370ed1cb13e50d | |
parent | fc1905bb9340304fb5980841fca24638028c1c5e (diff) | |
download | git-313ce8cee665447e4476d7e8985b270346a8e5a1.tar.gz git-313ce8cee665447e4476d7e8985b270346a8e5a1.tar.xz |
gitweb: Show '...' links in "summary" view only if there are more items
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 <jnareb@gmail.com>
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-x | gitweb/gitweb.perl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4059894e0..ebbc397ee 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -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'); @@ -2952,6 +2954,8 @@ 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"); @@ -2959,17 +2963,20 @@ sub git_summary { 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")}, "...")); } |