devongovett / glob-match

An extremely fast glob matching library in Rust.
MIT License
325 stars 13 forks source link

fix: 🚑 pattern with globstar and star fails to match #11

Open lucas-labs opened 8 months ago

lucas-labs commented 8 months ago

This aims to address some of the issues reported in #9.

The cases reported there now work, although there are still scenarios not covered by this fix (but, well, they're failing right now too, so I guess some is better than nothing).

I must be honest and admit that if I were to explain why this change resolves some of the reported cases, I would struggle. It made sense when I was deep in ninja mode, debugging the code and tinkering with things, but after spending a day trying to grasp the entire algorithm, I still can't quite wrap my head around it. The state transitions were perhaps too much for my modest brain, haha... So, while all tests are passing on my end, including the new ones, this would benefit from a thorough review, just to be sure.

Here are some of the cases that were failing before this change and are now passing:

assert!(glob_match("/**/*a", "/a/a"));
assert!(glob_match("**/*.js", "a/b.c/c.js"));
assert!(glob_match("**/**/*.js", "a/b.c/c.js"));
assert!(glob_match("a/**/*.d", "a/b/c.d"));
assert!(glob_match("a/**/*.d", "a/.b/c.d"));

And here are some cases that were failing before this change and would continue to fail afterward:

assert!(glob_match("**/*/**", "a/b/c"));
assert!(glob_match("**/*/c.js", "a/b/c.js"));;
shulaoda commented 6 months ago

@devongovett

SyMind commented 4 months ago

@lucas-labs I have made all cases to pass in #17 .

perryqh commented 1 week ago

This works for my bug too.

assert!(glob_match("**/*.js", "a/b/.c.js"));

What's preventing this from getting merged?

shulaoda commented 1 week ago

What's preventing this from getting merged?

The author should be too busy

SyMind commented 1 week ago

@perryqh use this https://github.com/shulaoda/fast-glob