user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/5] config: glob2re: fix over-matching /**/foo
  2024-01-16 11:52  5% [PATCH 0/5] www: coderepo updates Eric Wong
@ 2024-01-16 11:52  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2024-01-16 11:52 UTC (permalink / raw)
  To: meta

Noticed while adding wildcard support to WwwCoderepo...
---
 lib/PublicInbox/Config.pm | 2 +-
 t/config.t                | 3 ++-
 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 = '';

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] www: coderepo updates
@ 2024-01-16 11:52  5% Eric Wong
  2024-01-16 11:52  7% ` [PATCH 4/5] config: glob2re: fix over-matching /**/foo Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2024-01-16 11:52 UTC (permalink / raw)
  To: meta

1+2 are old cleanups I finally got around to...

3-5 fix and support globbing in URIs for to make it easier to
filter projects by basename or username/projectname.

In other words, https://yhbt.net/lore/**/vfs.git can
quickly find all the vfs.git repos mirrored from git.k.o.
Apparently, '*' is fine unescaped in URLs :o

I'll probably rely on the basename to make solver and
inbox <=> coderepo mappings display more nicely in WWW
(but I keep getting distracted playing w/ Parse::RecDescent :x)

Eric Wong (5):
  tests: clarify Email::MIME is only for development
  examples/unsubscribe-milter@.service: use KillMode=process
  config: don't vivify invalid fields for coderepos
  config: glob2re: fix over-matching /**/foo
  www: repolist: support globbing in URL

 examples/unsubscribe-milter@.service | 6 ++++++
 lib/PublicInbox/Config.pm            | 6 +++---
 lib/PublicInbox/RepoList.pm          | 4 ++--
 lib/PublicInbox/TestCommon.pm        | 1 +
 lib/PublicInbox/WwwCoderepo.pm       | 6 +++++-
 t/config.t                           | 3 ++-
 t/eml.t                              | 6 +++---
 t/import.t                           | 3 ++-
 t/mime.t                             | 4 ++--
 9 files changed, 26 insertions(+), 13 deletions(-)


^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2024-01-16 11:52  5% [PATCH 0/5] www: coderepo updates Eric Wong
2024-01-16 11:52  7% ` [PATCH 4/5] config: glob2re: fix over-matching /**/foo Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).