From ec46cae1685813ada8bf5ef5be13d9024ad9cc90 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 28 Nov 2022 05:31:29 +0000 Subject: [PATCH] lei_mirror: fix glob semantics to match end-of-path Globs such as `*/foo' should not match `*/foobar', this allows cloning only `git' and not `gitolite-transparency-log` off lore --- lib/PublicInbox/LeiMirror.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index a7ddfcd2..40164b67 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -506,18 +506,18 @@ sub multi_inbox ($$$) { my $n = scalar(keys %$v2) + scalar(@v1); my @orig = defined($incl // $excl) ? (keys %$v2, @v1) : (); if (defined $incl) { - my $re = '(?:'.join('|', map { - $self->{lei}->glob2re($_) // qr/\A\Q$_\E\z/ - } @$incl).')'; + my $re = '(?:'.join('\\z|', map { + $self->{lei}->glob2re($_) // qr/\A\Q$_\E/ + } @$incl).'\\z)'; my @gone = delete @$v2{grep(!/$re/, keys %$v2)}; delete @$m{map { @$_ } @gone} and $self->{-culled_manifest} = 1; delete @$m{grep(!/$re/, @v1)} and $self->{-culled_manifest} = 1; @v1 = grep(/$re/, @v1); } if (defined $excl) { - my $re = '(?:'.join('|', map { - $self->{lei}->glob2re($_) // qr/\A\Q$_\E\z/ - } @$excl).')'; + my $re = '(?:'.join('\\z|', map { + $self->{lei}->glob2re($_) // qr/\A\Q$_\E/ + } @$excl).'\\z)'; my @gone = delete @$v2{grep(/$re/, keys %$v2)}; delete @$m{map { @$_ } @gone} and $self->{-culled_manifest} = 1; delete @$m{grep(/$re/, @v1)} and $self->{-culled_manifest} = 1; -- 2.44.0