-
-
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
.gitignore not respected outside of git repositories #1109
Comments
Your |
The example was badly chosen. But the problem persists inside the home directory also. Here is a better example:
|
Well, is
|
ok, I changed .gitignore to .rgignore and problem solved.
|
Right, in a git repository. I agree that the docs could be more precise on this point. In particular, I do not think ripgrep always behaved this way, but I can't find the corresponding bug report that prompted the change to require a git repository before respecting |
Note that currently, if rg follows a symlink that points to a subdirectory of a git repo, it will not detect that it is in a git repo, and thus won't respect a gitignore file in that subdirectory (even though that gitignore is indeed in a git repo), as shown by:
I would thus suggest revisiting the choice of not respecting gitignores outside of git repos -- the alternative being, I guess, to check for each resolved symlink whether it is in a git repo. |
@anntzer Yes, that's interesting, although it's definitely a distinct bug from this ticket. My guess is that I'd probably mark it as |
That's why I listed checking the resolved paths as the alternative solution -- if you don't remember what change prompted you to ignore gitignores outside of git repositories, perhaps you can consider the above an argument in favor of always taking them into account? |
Sure, thanks for the reference. |
A note for future readers: The ~/.ignore file DOES work for non-git repos. It is just the .gitignore file that does not work |
What version of ripgrep are you using?
How did you install ripgrep?
macports
What operating system are you using ripgrep on?
mac osx 10.14.1 (mojave)
Describe your question, feature request, or bug.
here is my .gitignore file:
I am trying to ignore pdf files in my rg search.
Here is a test directory:
The problem is that the file
a.pdf
should be ignored.The text was updated successfully, but these errors were encountered: