From 7b7d4bd01b564969eb0c1904a5bd9ee4f3dbba72 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 23 Oct 2021 20:19:37 +0000 Subject: git: simplify local_nick, avoid "foo.git.git" We need to use a non-greedy regexp to avoid capturing the ".git" suffix in the pathname before blindly appending our own. --- t/git.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/git.t b/t/git.t index fa541f41..08b4a918 100644 --- a/t/git.t +++ b/t/git.t @@ -18,7 +18,13 @@ use PublicInbox::Git; is($?, 0, 'fast-import succeeded'); } { - my $git = PublicInbox::Git->new($dir); + my $git = PublicInbox::Git->new("$dir/foo.git"); + my $nick = $git->local_nick; # internal sub + unlike($nick, qr/\.git\.git\z/, "no doubled `.git.git' suffix"); + like($nick, qr/\.git\z/, "one `.git' suffix"); + $git = PublicInbox::Git->new($dir); + $nick = $git->local_nick; # internal sub + like($nick, qr/\.git\z/, "local nick always adds `.git' suffix"); my @s = $git->date_parse('1970-01-01T00:00:00Z'); is($s[0], 0, 'parsed epoch'); local $ENV{TZ} = 'UTC'; -- cgit v1.2.3-24-ge0c7