What's wrong
ResolveGlob (TextFilter/TextFilter.cs:~412-444) passes a ** through to DotNet.Glob unchanged. DotNet.Glob only treats ** as a wildcard when it is a whole path segment. When it touches other characters it means "zero directories", so it matches nothing. In a text filter, where a person types a pattern into a box and expects * semantics, a doubled star therefore empties the results instead of behaving like *.
Reproduction (HEAD d19c5b4)
| Call |
Result |
Same pattern with one * |
IsMatch("xfoo", "**foo", Glob) |
false (only matches foo exactly) |
*foo → true |
IsMatch("axb", "a**b", Glob) |
false |
a*b → true |
IsMatch("ab", "a**b", Glob) |
false |
a*b → true |
Calling Glob.Parse directly gives the same results, so this isn't a regression from the #114 masking. The root cause is the same one behind #126, but the fix #126 proposes (rewriting ** followed by a separator) wouldn't cover it: here ** is next to letters, not separators.
Why it matters
Typing an extra * is an easy slip, and some people type ** on purpose, expecting "anything". Either way the item list silently goes empty, and nothing says the pattern is to blame.
Suggested fix
In ResolveGlob, before masking, collapse any run of two or more * that is not a whole path segment down to a single *. A regex on runs of * with separator/boundary lookarounds would do it. Leave whole-segment ** for the #126 fix. Doing both in one PR keeps the ** rules in one place.
Acceptance criteria
What's wrong
ResolveGlob(TextFilter/TextFilter.cs:~412-444) passes a**through to DotNet.Glob unchanged. DotNet.Glob only treats**as a wildcard when it is a whole path segment. When it touches other characters it means "zero directories", so it matches nothing. In a text filter, where a person types a pattern into a box and expects*semantics, a doubled star therefore empties the results instead of behaving like*.Reproduction (HEAD d19c5b4)
*IsMatch("xfoo", "**foo", Glob)false(only matchesfooexactly)*foo→trueIsMatch("axb", "a**b", Glob)falsea*b→trueIsMatch("ab", "a**b", Glob)falsea*b→trueCalling
Glob.Parsedirectly gives the same results, so this isn't a regression from the #114 masking. The root cause is the same one behind #126, but the fix #126 proposes (rewriting**followed by a separator) wouldn't cover it: here**is next to letters, not separators.Why it matters
Typing an extra
*is an easy slip, and some people type**on purpose, expecting "anything". Either way the item list silently goes empty, and nothing says the pattern is to blame.Suggested fix
In
ResolveGlob, before masking, collapse any run of two or more*that is not a whole path segment down to a single*. A regex on runs of*with separator/boundary lookarounds would do it. Leave whole-segment**for the #126 fix. Doing both in one PR keeps the**rules in one place.Acceptance criteria
**foomatchesxfooandfoo.a**bmatchesabandaxb.foo**matchesfoobar.**/patterns match nothing since the #114 separator fix:src/**/*.csand**/*.csfilter out every path #126 cases once that is fixed, still pass.