about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiExternal.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-11-01 09:36:12 +0000
committerEric Wong <e@80x24.org>2022-11-02 17:04:22 +0000
commit63e976b54f8bf8d5e9bc918b081ae9417f653c60 (patch)
treecb72fd2f9172921c8ac6618e40b8cbc519698c4a /lib/PublicInbox/LeiExternal.pm
parentefac06297ad19bdda330dc1c1de00f78b4ef9d39 (diff)
downloadpublic-inbox-63e976b54f8bf8d5e9bc918b081ae9417f653c60.tar.gz
Globs such as `*/foo' should not match `*/foobar'.  I noticed
this while adding glob support to public-inbox-clone.

This may subtly break some existing cases, but there aren't many
lei users, yet, and globbing semantics should match what most
other glob-using programs, do...

We'll also make `lei ls-mail-sync' behave more consistently with
`lei ls-external', as far as the basename matching fallback
goes.
Diffstat (limited to 'lib/PublicInbox/LeiExternal.pm')
-rw-r--r--lib/PublicInbox/LeiExternal.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiExternal.pm b/lib/PublicInbox/LeiExternal.pm
index 30bb1a45..a6562e7f 100644
--- a/lib/PublicInbox/LeiExternal.pm
+++ b/lib/PublicInbox/LeiExternal.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # *-external commands of lei
@@ -88,7 +88,7 @@ sub get_externals {
         my @cur = externals_each($self);
         my $do_glob = !$self->{opt}->{globoff}; # glob by default
         if ($do_glob && (my $re = glob2re($loc))) {
-                @m = grep(m!$re!, @cur);
+                @m = grep(m!$re/?\z!, @cur);
                 return @m if scalar(@m);
         } elsif (index($loc, '/') < 0) { # exact basename match:
                 @m = grep(m!/\Q$loc\E/?\z!, @cur);