diff options
author | Eric Wong <e@80x24.org> | 2023-02-14 13:17:39 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-02-15 04:51:21 +0000 |
commit | bc54a149d08e9eac58a14c77b3df29fdb2f07fb8 (patch) | |
tree | 0fd432fd61860f97db680f0753cf765583c98dd7 /lib/PublicInbox | |
parent | 1d88b8639596a549dd972e113b52f9c2d035d529 (diff) | |
download | public-inbox-bc54a149d08e9eac58a14c77b3df29fdb2f07fb8.tar.gz |
We need to account for `git log' showing nothing for invalid branches and continue to render properly. We'll also quiet down `git log' stderr to avoid cluttering stderr, too.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/WwwCoderepo.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm index 8a490b6c..52ab6e48 100644 --- a/lib/PublicInbox/WwwCoderepo.pm +++ b/lib/PublicInbox/WwwCoderepo.pm @@ -123,17 +123,16 @@ sub _refs_tags_link { sub summary_finish { my ($ctx) = @_; my $wcb = delete($ctx->{env}->{'qspawn.wcb'}) or return; # already done - my @x = split(/\n\n/sm, delete($ctx->{-each_refs})); + my @x = split(/\n\n/sm, delete($ctx->{-each_refs}), 3); PublicInbox::WwwStream::html_init($ctx); my $zfh = $ctx->zfh; # git log - my @r = split(/\n/s, pop(@x) // ''); + my @r = split(/\n/s, pop(@x)); 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).' --'; - } + my $tip = $ctx->{qp}->{h}; + $tip_html .= ' '.ascii_html($tip).' --' if defined $tip; print $zfh <<EOM; <pre><a id=log>\$</a> git log --pretty=format:'%h %s (%cs)%d'$tip_html EOM @@ -146,7 +145,7 @@ EOM " (", $cs, ")\n"; print $zfh "\t(", ascii_html($d), ")\n" if $d; } - print $zfh "# no commits, yet\n" if !@r; + print $zfh '# no commits in `', ($tip//'HEAD'),"', yet\n\n" if !@r; print $zfh "...\n" if $last; # README @@ -216,9 +215,10 @@ sub summary { "$EACH_REF --count=$nb refs/heads; echo && " . "$EACH_REF --count=$nt refs/tags; echo && " . qq(git log -$nl --pretty=format:'%d %H %h %cs %s' "\$@" --)); - push @cmd, '--', $tip if defined($tip); + push @cmd, 'git', $tip if defined($tip); my $qsp = PublicInbox::Qspawn->new(\@cmd, - { GIT_DIR => $ctx->{git}->{git_dir} }); + { GIT_DIR => $ctx->{git}->{git_dir} }, + { quiet => 1, 2 => $self->{log_fh} }); $qsp->{qsp_err} = \($ctx->{-qsp_err} = ''); $tip //= 'HEAD'; my @try = ("$tip:README", "$tip:README.md"); # TODO: configurable |