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

Most upvoted comments

šŸ˜† re the explanation of the ignore tag, thanks for the clarification 😃

I just use git grep instead 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/*/migrations

It 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 --ignored to get the ignore list rather than parsing .gitignore directly.

Would definitely like this 😃 big fan of ag, my hands are trained on it!