From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 7/7] www_coderepo: summary: fix mis-linkification of `...'
Date: Sat, 28 Jan 2023 11:02:55 +0000 [thread overview]
Message-ID: <20230128110255.2950084-8-e@80x24.org> (raw)
In-Reply-To: <20230128110255.2950084-1-e@80x24.org>
We need to use the ternary operator in assignments to clobber
previous values of `$last'.
---
lib/PublicInbox/WwwCoderepo.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm
index d28b1a03..7a2cb80b 100644
--- a/lib/PublicInbox/WwwCoderepo.pm
+++ b/lib/PublicInbox/WwwCoderepo.pm
@@ -129,7 +129,7 @@ sub summary_finish {
# git log
my @r = split(/\n/s, pop(@x) // '');
- my $last = pop(@r) if scalar(@r) > $ctx->{wcr}->{summary_log};
+ my $last = scalar(@r) > $ctx->{wcr}->{summary_log} ? pop(@r) : undef;
my $tip_html = '';
if (defined(my $tip = $ctx->{qp}->{h})) {
$tip_html .= ' '.ascii_html($tip).' --';
@@ -165,14 +165,14 @@ EOM
# refs/heads
print $zfh '<a id=heads>', $HEADS_CMD , '</a>';
@r = split(/^/sm, shift(@x) // '');
- $last = pop(@r) if scalar(@r) > $ctx->{wcr}->{summary_branches};
+ $last = scalar(@r) > $ctx->{wcr}->{summary_branches} ? pop(@r) : undef;
chomp(@r);
for (@r) { print $zfh _refs_heads_link($_, './') }
print $zfh $NO_HEADS if !@r;
print $zfh qq(<a href="refs/heads/">...</a>\n) if $last;
print $zfh "\n<a id=tags>", $TAGS_CMD, '</a>';
@r = split(/^/sm, shift(@x) // '');
- $last = pop(@r) if scalar(@r) > $ctx->{wcr}->{summary_tags};
+ $last = scalar(@r) > $ctx->{wcr}->{summary_tags} ? pop(@r) : undef;
my ($snap_pfx, @snap_fmt) = _snapshot_link_prep($ctx);
chomp @r;
for (@r) { print $zfh _refs_tags_link($_, './', $snap_pfx, @snap_fmt) }
prev parent reply other threads:[~2023-01-28 11:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 11:02 [PATCH 0/7] www_coderepo updates Eric Wong
2023-01-28 11:02 ` [PATCH 1/7] www_coderepo: tree: quiet and 404 on non-existent refs Eric Wong
2023-01-28 11:02 ` [PATCH 2/7] www_coderepo: support /$REPO/tags.atom endpoint Eric Wong
2023-01-28 11:02 ` [PATCH 3/7] www_coderepo: fix snapshot link generation Eric Wong
2023-01-28 11:02 ` [PATCH 4/7] www_coderepo: reduce utf8::decode calls Eric Wong
2023-01-28 11:02 ` [PATCH 5/7] repo_atom: translate: account for multiple args Eric Wong
2023-01-28 11:02 ` [PATCH 6/7] www_coderepo: support $REPO/refs/{heads,tags}/ endpoints Eric Wong
2023-01-28 11:02 ` Eric Wong [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
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230128110255.2950084-8-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/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 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).