]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: allow ->local_nick to return undef
authorEric Wong <e@80x24.org>
Tue, 4 Oct 2022 19:12:37 +0000 (19:12 +0000)
committerEric Wong <e@80x24.org>
Wed, 5 Oct 2022 21:15:27 +0000 (21:15 +0000)
It'll be used directly (outside of ->pub_urls) in the
standalone coderepo viewer for tarball snapshots.

lib/PublicInbox/Git.pm

index 395add1fecee08305e6748b989a341b89b0b526d..691462eda4880533cae6357f20bc663a235936e3 100644 (file)
@@ -451,7 +451,7 @@ sub DESTROY { cleanup(@_) }
 
 sub local_nick ($) {
        # don't show full FS path, basename should be OK:
-       $_[0]->{git_dir} =~ m!/([^/]+?)(?:/*\.git/*)?\z! ? "$1.git" : '???';
+       $_[0]->{git_dir} =~ m!/([^/]+?)(?:/*\.git/*)?\z! ? "$1.git" : undef;
 }
 
 sub host_prefix_url ($$) {
@@ -478,7 +478,7 @@ sub pub_urls {
        if (my $urls = $self->{cgit_url}) {
                return map { host_prefix_url($env, $_) } @$urls;
        }
-       (local_nick($self));
+       (local_nick($self) // '???');
 }
 
 sub cat_async_begin {