Repository navigation
Escape a leading ':', '.' or '=' in gitignore bracket expressions - #194
Merged
Merged
Conversation
Owner
|
I'd never heard of the POSIX collating element or equivalence class before. Thanks for fixing this! |
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.
[:alpha:](without the outer brackets) is a valid gitignore line. Git reads it as a bracket expression of:,a,l,p,h, and that's what the simple and re2 backends do. The hyperscan backend fails to build the spec though, because the translated regex is passed through as[:alpha:]:Same for
[.a.]and[=a=]("Unsupported POSIX collating element"). Since hyperscan is picked by'best'when re2 isn't installed, one such line in a .gitignore breaks the whole spec.The fix escapes a leading
:,.or=in a non-negated bracket body, next to the existing^escape. Negated ones already start with[^/so they're fine. Matching doesn't change (checked againstgit ls-files -o -ion 2.47).Added
test_posix_like_bodyto test_08_gitignore_bracket_slash.py; it errors on hyperscan without the fix.python -m unittestpasses (332 tests, re2 and hyperscan installed).