-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 patterns beginning with '/' not treated correctly. #127
Comments
I should also note that as a temporary work around I've just adjusted the code to skip patterns starting with '/' so I don't miss important things. |
Would love to see this get added. Right now patterns like |
Same here (though I'm running version |
Just ran into this problem also. Using patterns that begin with '/' is the best practice in large projects if the exact directory structure is known, so this really is a crucial feature. My specific problem is having this in .gitignore:
Running ag blabla still returns matches from file tmp/performance/PERF-REPORT-234234234.html |
Just ran into this problem too. At first I thought that ag doesn't deal with gitignores in subfolders. Having support for this is IMO crucial, because look at for example the default gitignore of Rails projects:
|
Umm, 4148d6a seems to have reversed the proper handling of the leading |
Actually, reverting that commit will make ag treat slashes incorrectly. Instead of just ignoring It's safer to show extra matches than to silently ignore a file that the user expects to be searched. |
Ahh, I see. So we really need something that prepends a |
I would love to see this fixed 😸 |
This seems to be closed with #355 |
That is correct. |
👍 Thanks for fixing this! ❤️ |
Thanks 👌 |
For example, in the linux kernel tree's
/.gitignore
:Causes
ag
to ignore the path/include/linux
, which it should not (and recently caused me some pain).Mercurial allows this via '^' in regexes, git doesn't use regexes. On another note: as .hgignore uses actual regexes instead of glob patterns (which fnmatch handles), so I don't think they'll work at all.
Possible solutions I see from glancing at the code:
struct ignores
for these types of "full path relative to ignore dir" matches. Of course, there would need to be duplicatenames
andregexes
.regexes
andnames
. This could potentially decrease the cost of ignore look ups (or potentially increase it if branch-misses increase). It would also fix the lack of real hgignore support.The text was updated successfully, but these errors were encountered: