git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Robert Fitzsimons <robfitz@273k.net>
Subject: [PATCH] gitweb: Show '...' links in "summary" view only if there are more items
Date: Tue, 19 Dec 2006 12:14:57 +0100	[thread overview]
Message-ID: <200612191214.58474.jnareb@gmail.com> (raw)
In-Reply-To: <200612190159.24173.jnareb@gmail.com>

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.

Added some comments.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---

Jakub Narebski wrote:
> Junio C Hamano wrote:
>> Jakub Narebski <jnareb@gmail.com> writes:
>> 
>>> Actually, that is needed to implement checking if we have more than
>>> the number of commits to show to add '...' at the end only if there
>>> are some commits which we don't show.
[...]
>> By the way, I wonder how that $extra is omitted when $revlist is
>> longer than $to; it should be a trivial fix but it seems to me
>> that it is always spitted out with the current code.
> 
> We should check if we want to omit $extra, either in caller or
> in callee, the *_body subroutine itself.

And now it is done.

Slightly tested: on my clone (copy) of git repository, which more than
16 commits, more than 16 heads (most temporary, and no longer worked on,
few tracking branches) and more than 16 heads show all "..." as it should.
Test of freshly created repository shown no "..." for commits (only one
commit), no "..." for heads (only one default head 'master'), and no
tags list (no tags at all).

By the way, I have _NOT_ applied Robert Fitzsimons patch, but they
(this patch and Robert patch) should be not in conflict if we remove
last chunk of Robert's patch (this changing --count=17 to --count=15
in git_summary).

 gitweb/gitweb.perl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4059894..73877f2 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2915,8 +2915,9 @@ 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);
+	# we need to request one more than 16 (0..15) to check if those 16 are all
+	my @taglist  = git_get_tags_list(17);
+	my @headlist = git_get_heads_list(17);
 	my @forklist;
 	my ($check_forks) = gitweb_check_feature('forks');
 
@@ -2952,6 +2953,7 @@ 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 +2961,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")}, "..."));
 	}
 
-- 

  parent reply	other threads:[~2006-12-19 11:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-22 19:38 [PATCH 1/4] gitweb: Add missing show '...' links change Robert Fitzsimons
2006-12-18 22:43 ` [PATCH] Small optimizations to gitweb Robert Fitzsimons
2006-12-18 23:17   ` Jakub Narebski
2006-12-18 23:45     ` Junio C Hamano
2006-12-19  0:59       ` Jakub Narebski
2006-12-19  5:48         ` Junio C Hamano
2006-12-19 11:14         ` Jakub Narebski [this message]
2006-12-19 12:08           ` [PATCH] gitweb: Show '...' links in "summary" view only if there are more items Robert Fitzsimons
2006-12-19 12:28             ` Jakub Narebski
2006-12-19 12:41               ` Robert Fitzsimons
2006-12-19 12:42               ` Jakub Narebski
2006-12-19 18:05               ` Junio C Hamano
     [not found]   ` <8edd09bf9114df40281e7527df8704b1a94bb280.1166813858.git.robfitz@273k.net>
2006-12-22 19:38     ` [PATCH 1/4] gitweb: Add missing show '...' links change Robert Fitzsimons
2006-12-22 19:38       ` [PATCH 2/4] gitweb: optimize git_get_last_activity Robert Fitzsimons
2006-12-22 19:38         ` [PATCH 3/4] gitweb: optimize git_shortlog_body Robert Fitzsimons
2006-12-22 19:38           ` [PATCH 4/4] gitweb: optimize git_summary Robert Fitzsimons
2006-12-22 20:07         ` [PATCH 2/4] gitweb: optimize git_get_last_activity Jakub Narebski
2006-12-22 20:09 ` [PATCH 1/4] gitweb: Add missing show '...' links change Jakub Narebski
2006-12-22 21:52   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612191214.58474.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=robfitz@273k.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).