]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mirror: omit trailing slash for git remote.*.url
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:32:27 +0000 (05:32 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:59 +0000 (23:38 +0000)
While PublicInbox::WWW URLs have a trailing slash in them
for compatibility with static web server mirrors, URLs
intended for `git clone' don't benefit from this and the
trailing `/' just looks awkward.

lib/PublicInbox/LeiMirror.pm

index cf4e58f1bab47a6d04f0a9af000f6de12156c40b..5b7cf9e6eaea469d8d2d42116ca4169c2e73f13a 100644 (file)
@@ -533,6 +533,8 @@ sub clone_v1 {
        my $lei = $self->{lei};
        my $curl = $self->{curl} //= PublicInbox::LeiCurl->new($lei) or return;
        my $uri = URI->new($self->{cur_src} // $self->{src});
+       my $path = $uri->path;
+       $path =~ s!/*\z!! and $uri->path($path);
        defined($lei->{opt}->{epoch}) and
                die "$uri is a v1 inbox, --epoch is not supported\n";
        $self->{-torsocks} //= $curl->torsocks($lei, $uri) or return;