diff options
author | Eric Wong <e@80x24.org> | 2023-01-28 11:02:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-28 18:52:34 +0000 |
commit | 4a2e1f38e75ef3ce8bffc8f2b59b18b32420c0fc (patch) | |
tree | 354145ceb6cc78946521701a6cb21c21758e0c6c | |
parent | 66e8f07efb1893703dc98c21dbf3680f6216ea7d (diff) | |
download | public-inbox-4a2e1f38e75ef3ce8bffc8f2b59b18b32420c0fc.tar.gz |
We need to use the ternary operator in assignments to clobber previous values of `$last'.
-rw-r--r-- | lib/PublicInbox/WwwCoderepo.pm | 6 |
1 files 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) } |