]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: local_nick: handle trailing or redundant '/' in git_dir
authorEric Wong <e@80x24.org>
Mon, 29 Mar 2021 23:58:54 +0000 (23:58 +0000)
committerEric Wong <e@80x24.org>
Tue, 30 Mar 2021 06:26:05 +0000 (02:26 -0400)
Some cgit configs use trailing slashes in pathnames
which we preserve internally.

Before this change, trailing slashes in cgit config files
was causing ViewVCS (SolverGit) output to show up as "???"
for coderepos without cgitUrl configured.

lib/PublicInbox/Git.pm

index 2ae5eff9c01614a13f0781561c9aed64d1a52838..96ac17a33fc1bcca221fe73a5401107240d8202f 100644 (file)
@@ -426,7 +426,7 @@ sub local_nick ($) {
        my ($self) = @_;
        my $ret = '???';
        # don't show full FS path, basename should be OK:
-       if ($self->{git_dir} =~ m!/([^/]+)(?:/\.git)?\z!) {
+       if ($self->{git_dir} =~ m!/([^/]+)(?:/*\.git/*)?\z!) {
                $ret = "$1.git";
        }
        wantarray ? ($ret) : $ret;