ripgrep 0.9.0
-SIMD -AVX
pacman -S ripgrep
Archlinux
Linux pc080 4.18.5-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 24 12:48:58 UTC 2018 x86_64 GNU/Linux
When I聽have this .gitignore file:
*
!*.*
the command ripgrep --files will show files in the .git directory, which does not make sense, because the .gitignore does not affect the files in the .git directory.
.gitignore file with the above content.rg --files.rg shows files in the .git directory.rg --files shows the files in the .git directory.
rg --files should not show the files in the .git directory because of a pattern of the .gitignore file.
This is a little tricky to fix in a consistent way. In particular, a .git directory is ignored because it's hidden, but the ignore matching rules permit any ignore-related file (.gitignore, .ignore, .rgignore) to override skipping hidden files when there is an explicit whitelist, which is the case here. To make this work like you expect, we'd have to special case the handling of git-specific ignore files to make it so it does not impact .git directories.
A work-around to this problem is to add .git/ to a .ignore file alongside your .gitignore. The simplicity of the work-around makes it tempting to declare this as wontfix, but I'll leave it open as something to consider if and when the ignore crate gets an overhaul.
I think the right answer here is to probably just add .git to your ignore file. It's a corner case with a simple work around that I think is better than complicating ignore more than it is.
Most helpful comment
This is a little tricky to fix in a consistent way. In particular, a
.gitdirectory is ignored because it's hidden, but the ignore matching rules permit any ignore-related file (.gitignore, .ignore, .rgignore) to override skipping hidden files when there is an explicit whitelist, which is the case here. To make this work like you expect, we'd have to special case the handling of git-specific ignore files to make it so it does not impact.gitdirectories.A work-around to this problem is to add
.git/to a.ignorefile alongside your.gitignore. The simplicity of the work-around makes it tempting to declare this aswontfix, but I'll leave it open as something to consider if and when theignorecrate gets an overhaul.