-
-
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
Feature request: case-insensitive .gitignore matching on Windows #1164
Comments
It's possible I could get on board with enabling this functionality with a flag, but I think the better solution is to probably stop relying on the case insensitivity of your file system in your If case insensitive globbing is enabled across ignore files, then the performance of matching ignore rules could substantially decrease in the presence of a large number of rules. |
I agree that better .gitignore files is a nicer strategy, especially because that way the repo would become a little closer to cross-platform. This works well for repos I own and I can advocate for others to do the same. That said, I often have to search across repos that I don’t own, and as long as .gitignore is case insensitive on Windows people will continue writing them in case insensitive ways. Is there a way I can help find out if the performance degradation of such a flag would be bad enough to keep me from using it (to at least provide one data point)? Maybe write a command with a giant --iglob that matches the .gitignore? |
I think the simplest way would be to just patch ripgrep to do case insensitive matching. I think if you just hacked globset to always enable case insensitivity, then I think that will do the trick. |
Alright, I’ll see if I can give that a try. |
I tried my patched version on my repos and it's fast enough for me, but I thought I'd gather some benchmarking data. I used the benchsuite detailed here but had trouble building the kernel, so I followed instructions from the Arch Wiki instead. I downloaded linux-4.20.3.tar.xz, turned it into a git repo, and built. For the hack, I changed this line in gitignore.rs to Builds of ripgrep were done using Setup:
For my first run, tired running the benchmark with the official package.
Next up, my built copy from 7cbc535.
Finally, my patched copy.
Overall it looks like ripgrep takes 1.5x longer with the patch. That's a pretty big hit, but it's already so fast that I personally wouldn't mind it. Thoughts on including this? If you're interested I can try working on the changes myself - I haven't worked in Rust before but I've been looking for a good opportunity, and just adding a flag to enable this looks like it would be a pretty minor change (famous last words). |
Excellent analysis, thank you! Yes, I would be OK adding this behind a flag. In principle, you're right, the change is simple. There is a fair bit of plumbing though. ripgrep is split up into libraries, so features like this need to be part of the public API of a library. For example, I'd probably expect it to be a new option on a If you want to give it a try, that'd be great! If you get stuck, feel free to just throw up a PR with what you've got and we can figure out how to go from there together. |
That makes sense, thanks for the direction. I'll give it a shot! |
What version of ripgrep are you using?
ripgrep 0.10.0 (rev 8a7db1a)
-SIMD -AVX (compiled)
How did you install ripgrep?
Downloaded ripgrep-0.10.0-i686-pc-windows-msvc.zip from the release page and installed rg.exe to a location in my path.
What operating system are you using ripgrep on?
Windows 10 Pro
Version 1803 (OS Build 17134.523)
Describe your feature request.
I'd like ripgrep to support case-insensitive .gitignore matching.
On Windows, the file system is case insensitive which inspired this issue #163 and the subsequent --iglob flag. However, it looks like the flag can't be used to make exclusions from the .gitignore case insensitive.
Here's an example on the Windows command line. You'll notice that
git status
doesn't listmyfile.txt
, but ripgrep does (of course on linux this isn't the case, and the file is listed twice).Sorry if I'm missing something obvious, or if this is covered by another issue. I tried searching the man page and didn't find any configuration regarding .gitignore, and found many issues related to case insensitive file matching but none as far as I could tell that asked for this specific feature.
The text was updated successfully, but these errors were encountered: