Repository navigation
Fix glob matching a hidden name with a wildcard after a leading star - #253
Merged
Merged
Conversation
A `?` or bracket expression right after a leading `*` could match the leading dot of a name, such as `*?a` matching `.a`. Add the leading-dot guard that wildcards after an extended group already use.
Owner
|
@gir-bot lgtm |
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.
In a directory with
.env,prod.env, andprod_env,glob.glob('*[._]env', root_dir=d)returns all three, but names starting with dot are not matched "unless matched with a literal dot".?a,fnmatch, and Bash 5.3 already refuse the dot.A leading
*may match nothing, leaving?or[...]after it unguarded._restrict_sequencealready guards this after an extended group; it now does the same after a star or a top-level!(...).*.astill matches.a.Three new rows fail before the fix; a
DOTGLOBrow passes both ways.