Fix wildcard match failing for mid-path segments#5
Merged
Conversation
AriehSchneier
approved these changes
Mar 26, 2026
|
I have some other bugs, I added them to the issue instead of here. |
Three fixes for pattern matching to align with git behavior: 1. The literalSuffix fast-reject optimization checked only the last path segment, but patterns with an implicit trailing ** can match any segment. Skip suffix extraction when the pattern ends with **. 2. Patterns with unclosed bracket expressions (e.g. "v[ou]l[") were treated as containing a literal "[". Git rejects these entirely. Now reported as a compilation error via Errors(). 3. Trailing /** patterns (e.g. "/a*/**") matched plain files when they should only match directories and their contents. Convert trailing /** to dirOnly semantics by stripping the ** and setting dirOnly. Fixes #4
568f576 to
62c9331
Compare
AriehSchneier
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes for pattern matching to align with git behavior:
The literalSuffix fast-reject optimization checked only the last path segment, but patterns with an implicit trailing ** can match any segment. A pattern like
v*owould fail to matchvalue/vulkano/tailbecause the suffixowas checked againsttailinstead ofvulkano. Skip suffix extraction when the pattern ends with**.Patterns with unclosed bracket expressions (e.g.
v[ou]l[) were treated as containing a literal[. Git rejects these patterns entirely. Now reported as a compilation error viaErrors().Trailing
/**patterns (e.g./a*/**) matched plain files when they should only match directories and their contents. In git,dir/**matchesdir/anddir/filebut notdiras a file. Convert trailing/**to dirOnly semantics by stripping the**and setting dirOnly.Fixes #4