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

trailing recursive globs shouldn't ignore the directory itself, only its contents #30

Closed
foophoof opened this issue Sep 23, 2016 · 1 comment
Labels
bug A bug.

Comments

@foophoof
Copy link

I have a .gitignore file that contains something like this:

vendor/**
!vendor/manifest

I'd expect vendor/manifest to be searched, but nothing else in the vendor directory, but instead it seems like vendor/manifest is ignored too. If I remove the vendor/** line, the search does what I expect it to.

@BurntSushi
Copy link
Owner

This is an interesting case, because rg will avoid descending into the vendor, which appears wrong, since vendor itself shouldn't be ignored. From man gitignore:

       ·   A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc",
           relative to the location of the .gitignore file, with infinite depth.

(Running rg with the --debug flag told me that vendor itself was ignored. rg never even sees vendor/manifest.)

@BurntSushi BurntSushi changed the title Negated gitignore patterns aren't supported trailing recursive globs shouldn't ignore the directory itself, only its contents Sep 24, 2016
@BurntSushi BurntSushi added the bug A bug. label Sep 24, 2016
amsharma91 added a commit to amsharma91/ripgrep that referenced this issue Sep 27, 2016
A standard glob of `foo/**` will match `foo`, but gitignore semantics
specify that `foo/**` should only match the contents of `foo` and not
`foo` itself. We capture those semantics by translating `foo/**` to
`foo/**/*`.

Fixes BurntSushi#30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants