-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for [[:space:]]
match group in the ignore crate
#2962
Comments
The only Now, the tests you link do seem to suggest that If git supports this syntax, then I'm probably open to supporting it as well. But I probably won't be adding it any time soon. |
It might help if you can find some git docs for the specific glob pattern syntax that is supported. |
I've not found a documentation entry for this, but a quick test with git 2.47.1 with the following commands indicate that this also seems to work for echo "/foo[[:space:]]bar.txt" >> .gitignore
git add .gitignore
git commit -m "Add [[:space:]] matcher"
touch foo\ bar.txt
git status
# foo\ bar.txt is not listed by git status |
Blech. Glob implementations are truly the wild west. I don't think I've ever seen that syntax in a glob before. |
it's specified in posix that shell patterns,
bash and zsh support for character classes is described here:
the
it doesn't, though. it uses a modified version of rsync's which i guess is good because otherwise it would be at the mercy of platform-specific inconsistencies like this (from freebsd and macos
|
Fair enough. I'm fine with adding stuff like this, but I draw the line at locale related shenanigans. |
This commit adds support for character classes to the glob matching implemented by globset. It just translates every class to the corresponding regex class. Fixes BurntSushi#2962
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ignore = "0.4.23"
How did you install ripgrep?
Cargo
What operating system are you using ripgrep on?
Fedora
Describe your bug.
The ignore crate fails to handle certain character classes as part of it's matcher implementation. I noticed this for
[[:space:]]
which happens to be contained in some local.gitattributes
file I try to parse and use via the ignore crate to teach [jj'](https://github.com/jj-vcs/jj/) to just ignore git-lfs files. Git itself [documents the pattern syntax](https://git-scm.com/docs/gitattributes) to be the same (beside minor restrictions) than that one from
.gitignore` files, therefore I've tried to use the ignore crate for this.What are the steps to reproduce the behavior?
Run the following code and see the assertion fail:
What is the actual behavior?
The assertion fails
What is the expected behavior?
The assertion passes. See the character class tests from the git repository itself here: https://github.com/git/git/blob/8d8387116ae8c3e73f6184471f0c46edbd2c7601/t/t3070-wildmatch.sh#L144 for future examples
The text was updated successfully, but these errors were encountered: