about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-16 11:52:54 +0000
committerEric Wong <e@80x24.org>2024-01-17 09:37:55 +0000
commitd99942aa64d7da35847999808f99a068ad25213c (patch)
treefdf1225fb2e91a99fac5ebc750e0adefd906ea89
parentfaeb2670791e3d20f20976e43f9587e2d51180e7 (diff)
downloadpublic-inbox-d99942aa64d7da35847999808f99a068ad25213c.tar.gz
Noticed while adding wildcard support to WwwCoderepo...
-rw-r--r--lib/PublicInbox/Config.pm2
-rw-r--r--t/config.t3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 33c59ec7..b8d3c485 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -662,7 +662,7 @@ sub squote_maybe ($) {
 }
 
 my %re_map = ( '*' => '[^/]*?', '?' => '[^/]',
-                '/**' => '/.*', '**/' => '.*/', '/**/' => '/.*?',
+                '/**' => '/.*', '**/' => '.*/', '/**/' => '(?:/.*?/|/)',
                 '[' => '[', ']' => ']', ',' => ',' );
 
 sub glob2re ($) {
diff --git a/t/config.t b/t/config.t
index 975cf836..c41a42d3 100644
--- a/t/config.t
+++ b/t/config.t
@@ -296,8 +296,9 @@ is_deeply($glob2re->('\\\\{a,b}'), '\\\\\\\\(a|b)', 'fake escape brace');
 is_deeply($glob2re->('**/foo'), '.*/foo', 'double asterisk start');
 is_deeply($glob2re->('foo/**'), 'foo/.*', 'double asterisk end');
 my $re = $glob2re->('a/**/b');
-is_deeply($re, 'a/.*?b', 'double asterisk middle');
+is_deeply($re, 'a(?:/.*?/|/)b', 'double asterisk middle');
 like($_, qr!$re!, "a/**/b matches $_") for ('a/b', 'a/c/b', 'a/c/a/b');
+unlike($_, qr!$re!, "a/**/b doesn't match $_") for ('a/ab');
 
 {
         my $w = '';