From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 578DA20186 for ; Mon, 28 Nov 2022 05:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613559; bh=Fbu5K8418dhd/p+FKzCBx+f8WuTJuWBugHCxj7T0KQo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u8TWxScHNaBO3ieGqFlPX2KGbSMPi/bHcodTWeHHjKTfqwSoy2LZ6GI550bBByCg/ 3DTBQLiLW9wyah4Td5RBx4t3Tjx0kUbisa5jEZ/YntL0rpvplMJ2sKo2dOl/EAkDSZ QWK7VU5rbxo7mJH2RjUk+vWtgep1nQGmlMY8B7DY= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 32/95] lei_mirror: fix glob semantics to match end-of-path Date: Mon, 28 Nov 2022 05:31:29 +0000 Message-Id: <20221128053232.291618-33-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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;