Skip to content
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 being properly parsed #1402

Open
rileyrg opened this issue Aug 20, 2020 · 5 comments
Open

.gitignore not being properly parsed #1402

rileyrg opened this issue Aug 20, 2020 · 5 comments

Comments

@rileyrg
Copy link

rileyrg commented Aug 20, 2020

If I use the "!" notation to reinclude subdirectories ag doesn't cope.

eg my .gitignore

*
!/editor-config
!/editor-config/*

ag will not search editor-config. This is quite a major issue preventing me using helm-ag instead of helm-rg.

@JaapJoris
Copy link

Here's a "me too!" from me. I ran into this issue and found this page via google.

@vmenajr
Copy link

vmenajr commented Feb 19, 2021

Just hit this today and though not ideal the -u works around the problem. Small price to pay for an amazing tool.

@rileyrg
Copy link
Author

rileyrg commented Feb 19, 2021

Just hit this today and though not ideal the -u works around the problem. Small price to pay for an amazing tool.

Yup it is / was. I moved onto ripgrep which parses globs properly in a hierarchical manner. And it's faster I think: certainly I had more success inside emacs with counsel-ripgrep over other implementations.

@systemmonkey42
Copy link

This is not the only problem with .gitignore. I'm finding if I have a path starting with '/' (eg, '/node_modules') and I run 'ag' from the same directory as the .gitignore, it correctly ignore the node_modules folder.

However if I run the same query from the parent directory, it misinterprets the '/node_modules' and proceeds to scan the '/repo/node_modules' folder.

I would expect a path starting with a '/' in a .gitignore (or any ignore file) would implicitly mean <subdir>/exclusion where <subdir> is the path to the ignore file.

Does this make sense?

@marc-guenther
Copy link

Sorry for hijacking this, but for me, .gitignore doesn't work at all (see #1381), not even for a simple entry like target. I have to symlink it to .ignore to make it work.

Apparently for you it works without the link? Could you quickly confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants