user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 7/7] www_coderepo: summary: fix mis-linkification of `...'
  2023-01-28 11:02  7% [PATCH 0/7] www_coderepo updates Eric Wong
@ 2023-01-28 11:02  6% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-01-28 11:02 UTC (permalink / raw)
  To: meta

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) }

^ permalink raw reply related	[relevance 6%]

* [PATCH 0/7] www_coderepo updates
@ 2023-01-28 11:02  7% Eric Wong
  2023-01-28 11:02  6% ` [PATCH 7/7] www_coderepo: summary: fix mis-linkification of `...' Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-01-28 11:02 UTC (permalink / raw)
  To: meta

Not aiming to achieve feature parity with cgit, but
trying to minimize 404s and provide hints/education for
CLI git usage...

And having an Atom feed for just tags (not all commits) can be
nice...

Eric Wong (7):
  www_coderepo: tree: quiet and 404 on non-existent refs
  www_coderepo: support /$REPO/tags.atom endpoint
  www_coderepo: fix snapshot link generation
  www_coderepo: reduce utf8::decode calls
  repo_atom: translate: account for multiple args
  www_coderepo: support $REPO/refs/{heads,tags}/ endpoints
  www_coderepo: summary: fix mis-linkification of `...'

 lib/PublicInbox/RepoAtom.pm    |  64 +++++++++---
 lib/PublicInbox/RepoTree.pm    |  22 ++++-
 lib/PublicInbox/WwwCoderepo.pm | 173 +++++++++++++++++++++++----------
 t/solver_git.t                 |  15 +++
 4 files changed, 209 insertions(+), 65 deletions(-)


^ permalink raw reply	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-01-28 11:02  7% [PATCH 0/7] www_coderepo updates Eric Wong
2023-01-28 11:02  6% ` [PATCH 7/7] www_coderepo: summary: fix mis-linkification of `...' Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.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).