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

Agignore not using the same patterns as gitignore #367

Open
pablox-cl opened this issue Mar 29, 2014 · 11 comments
Open

Agignore not using the same patterns as gitignore #367

pablox-cl opened this issue Mar 29, 2014 · 11 comments

Comments

@pablox-cl
Copy link

@pablox-cl pablox-cl commented Mar 29, 2014

Ok, here's the issue:

# gitignore as used by github/gitignore/Rails.gitignore
/vendor/bundle

$ ag treetop
vendor/bundle/gems/rack-livereload-0.3.15/gemfiles/rails32.gemfile.lock
81:      treetop (~> 1.4.8)
$ git ls-files | ag treetop
$ # empty result

# gitignore
vendor/bundle/

$ ag treetop
Gemfile.lock
86:      treetop (~> 1.4.8)
$ git ls-files | ag treetop
$ # empty result

So this means, ag and git are interpreting different a directive, that at least to gitignore it's the same (so it seems, I don't use leading slashes and I believe I haven't had any drawbacks). According to git documentation:

A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

I don't know how ag interprets leading slashes, but clearly they do different.


It seems that:

/vendor/bundle
vendor/bundle/

It's the same for git, they don't have trouble tracking files inside, like public/vendor/bundle/a_file.txt.

@nubs
Copy link

@nubs nubs commented May 7, 2014

What version of ag are you using? This appears to be fixed in master.

@jameswomack
Copy link

@jameswomack jameswomack commented May 8, 2014

I've ag version 0.21.0 installed via Homebrew and I experience this issue.

@ggreer
Copy link
Owner

@ggreer ggreer commented Jun 26, 2014

Please try the latest version of ag: 0.22.0

@jameswomack
Copy link

@jameswomack jameswomack commented Jun 26, 2014

@ggreer Thank you. 0.22.0 seems to work.

@jameswomack
Copy link

@jameswomack jameswomack commented Jun 26, 2014

...as long as the folders are prefixed by /

@pablox-cl
Copy link
Author

@pablox-cl pablox-cl commented Jul 3, 2014

Now I'm using 0.23.0, and works fine with .gitignore, when having leading slashes, but now it doesn't when they don't have (the opposite).

@jameswomack
Copy link

@jameswomack jameswomack commented Jul 7, 2014

@pablox-cl Same here.

@chibicode
Copy link

@chibicode chibicode commented Jul 30, 2014

Same issue here on 0.23.0

iizukanao added a commit to iizukanao/the_silver_searcher that referenced this issue Jul 31, 2014
@iizukanao
Copy link
Contributor

@iizukanao iizukanao commented Jul 31, 2014

A simple workaround for the current version: just put the leading slash.

@pablox-cl
Copy link
Author

@pablox-cl pablox-cl commented Nov 14, 2014

Using 0.26.0, I'm still finding the same issue, ag doesn't seem to respect .gitignore.
Sorry, the issue it has to do with ctrlp or vim, but not ag.

@brandon-rhodes
Copy link

@brandon-rhodes brandon-rhodes commented Feb 9, 2015

Under 0.29.1 I can confirm that ag seems to be working correctly, and that a pattern with slashes in it still applies whether or not it has a leading slash. So it is likely that this issue can now be closed! Thanks for getting this fixed.

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

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.