the_silver_searcher: Double-star in ignore glob patterns does not work
I have a rule /public/**/*.js in my .gitignore file, which means ignore any file ending in .js which is in /public or any subdirectory of /public. Ag is still giving results from such files.
About this issue
- Original URL
- State: open
- Created 10 years ago
- Reactions: 17
- Comments: 19 (1 by maintainers)
Commits related to this issue
- Change gitignore pattern because ag does not recognize double asterisks Details https://github.com/ggreer/the_silver_searcher/issues/530 — committed to talha131/dotfiles by talha131 8 years ago
- Switch from ag to rg Because patterns with double-star globs in .ignore files doesn't work with ag: https://github.com/ggreer/the_silver_searcher/issues/530 — committed to torbiak/dotfiles by torbiak 4 years ago
- vim: Use rg instead of ag for searching inside files with fzf Update vim's fzf plugin to use rg (ripgrep) instead of ag (silversearcher) to perform searches inside files, using [1] as a guide. rg is... — committed to jcanseco/.dotfiles by jcanseco 2 years ago
š re the explanation of the ignore tag, thanks for the clarification š
I just use
git grepinstead of this package and no longer have to worry about things like this.Yes, this requires some changes to the ignoring code to work correctly. I donāt use double-stars in my gitignores, so Iāve kinda neglected it. Sorry. š¦
Note: The āignoreā label is for issues with git/hg/ag-ignores. It doesnāt mean Iām going to ignore the issue.
@kballard I reported bug: https://github.com/ggreer/the_silver_searcher/issues/1060
Adding leaning slash allows matches of path with asterisksā¦
For your case it is
/p/main/*/migrationsIt would be nice if this got fixed. I was quite disappointed to discover that even though the readme says
It ignores file patterns from your .gitignore and .hgignore.thatās not really the case š.Reading @decaffās published fix this doesnāt seem too hard to implement.
@ggreer would you consider a PR for this?
As noted in https://github.com/ggreer/the_silver_searcher/issues/594#issuecomment-85543490, this could be solved for git by using
git status --ignoredto get the ignore list rather than parsing .gitignore directly.Would definitely like this š big fan of ag, my hands are trained on it!