From: Jakub Narebski <jnareb@gmail.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: git@vger.kernel.org, Lea Wiemann <LeWiemann@gmail.com>
Subject: Re: [PATCH] gitweb: only display "next" links in logs if there is a next page
Date: Wed, 28 May 2008 02:01:53 -0700 (PDT) [thread overview]
Message-ID: <m33ao23iqv.fsf@localhost.localdomain> (raw)
In-Reply-To: <1211930742-24978-1-git-send-email-LeWiemann@gmail.com>
Lea Wiemann <lewiemann@gmail.com> writes:
> 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.
Thanks for correcting this.
> sub format_paging_nav {
> - my ($action, $hash, $head, $page, $nrevs) = @_;
> + my ($action, $hash, $head, $page, $has_next_link) = @_;
> my $paging_nav;
>
>
> @@ -2774,7 +2774,7 @@ sub format_paging_nav {
> $paging_nav .= " ⋅ prev";
> }
>
> - if ($nrevs >= (100 * ($page+1)-1)) {
> + if ($has_next_link) {
> $paging_nav .= " ⋅ " .
> $cgi->a({-href => href(-replay=>1, page=>$page+1),
> -accesskey => "n", -title => "Alt-n"}, "next");
This makes logic much simpler. Nice change.
> @@ -4665,7 +4665,7 @@ sub git_log {
>
> my @commitlist = parse_commits($hash, 101, (100 * $page));
Here I have realized the source of this bug. Some time ago
git-rev-list acquired '--skip=<number>' option to have _git_ skip
commits and not _gitweb_, which improves performance a bit. It was
required to implement huge performance improvement, namely getting
details for all commits from a single command, otherwise the
performance improvement of calling one git command instead of
$page_size git commands would be much reduced by generating large
amount of data which would be skipped (wound't be used by gitweb).
Unfortunately this change wasn't reviewed carefully enough; old logic
to decide whether to add 'next' link compared (tried to compare)
number of commits receivied with number of commits requested (via
'--max-count=<number>' option). I guess that having format_paging_nav
decide whether to add "next" link was a bad idea...
> - 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);
>
I would agree with Junio here that @commitlist > 100 would be more
readable.
Logic goes as the following: we request ($page_size+1) revisions to
know if there are additional revisions, skipping ($page_size * $page)
revisions; gitweb adds 'next' link if it got more than $page_size
revisions.
> git_header_html();
> git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
> @@ -5585,7 +5585,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 =
What about git_history()... oh, I see, it generates paging itself, and
soes not use format_paging_nav() subroutine. But I think it does not
exhibit mentioned (and corrected) error. BTW. I *guess* that with
href(-replay=>1, ...) gitweb could use format_paging_nav() also for
other pages...
--
Jakub Narebski
Poland
ShadeHawk on #git
prev parent reply other threads:[~2008-05-28 9:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 22:31 [PATCH] gitweb: only display "next" links in logs if there is a next page Lea Wiemann
2008-05-27 23:08 ` Junio C Hamano
2008-05-27 23:23 ` Lea Wiemann
2008-05-27 23:25 ` Lea Wiemann
2008-05-27 23:30 ` Lea Wiemann
2008-05-28 0:04 ` Junio C Hamano
2008-05-28 0:10 ` Lea Wiemann
2008-05-28 9:01 ` Jakub Narebski [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m33ao23iqv.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=lewiemann@gmail.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.