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

Not respecting .gitignore? #43

Closed
rstacruz opened this issue Jun 17, 2012 · 10 comments
Closed

Not respecting .gitignore? #43

rstacruz opened this issue Jun 17, 2012 · 10 comments
Assignees

Comments

@rstacruz
Copy link

@rstacruz rstacruz commented Jun 17, 2012

The readme says "It ignores files matched by patterns in your .gitignore and .hgignore." I can't make this work, however.

I tried running ag hello in a Git repo where /logs/*.log is .gitignored. Doing git grep hello works as expected, but ag hello seems to scan logs/development.log for the word.

@ggreer
Copy link
Owner

@ggreer ggreer commented Jun 18, 2012

Thanks for submitting this bug report, but can you give me more info? It'd be handy to see:

  • The line in your .gitignore that ignores the log files.
  • The paths to the .gitignore file and log file.
  • The parameters you're passing to ag and the directory you're running it in.

Without this information, it's really hard for me to reproduce the bug. If I can't reproduce it, I can't fix it.

@rstacruz
Copy link
Author

@rstacruz rstacruz commented Jun 18, 2012

In the report above, the ignore line is /logs/*.log. The command was ag hello. It was ran on the git repo. It's easily-reproduceable too:

@rstacruz
Copy link
Author

@rstacruz rstacruz commented Jun 18, 2012

I deleted my long paste comment and put it in a gist here. I hope this helps. https://gist.github.com/ef4af99306276aa31637

@ggreer
Copy link
Owner

@ggreer ggreer commented Jun 18, 2012

Thanks for giving me a failure case.

echo "/logs/*.log" > .gitignore

I'm just running fnmatch on the lines, so specifying a path doesn't work. I knew git allowed paths but totally spaced on adding support for it.

Fixing this will probably take me a little while. Be patient.

@ghost ghost assigned ggreer Jun 18, 2012
@rstacruz
Copy link
Author

@rstacruz rstacruz commented Jun 18, 2012

These gitignore lines don't work with ag either:

/logs
/logs/
logs/*
/logs/file.log
logs/file.log

These work:

logs
file.log

...all of these will ignore the file in question in Git.

@ggreer
Copy link
Owner

@ggreer ggreer commented Jul 13, 2012

Just FYI, I haven't forgotten about this issue. Fixing it requires quite a few changes, since scandir() doesn't pass the current path to the filter function that it calls on each directory entry. I might start off with a half-assed fix that uses a global, but I'd prefer to make this easier to parallelize. The right solution is to write my own scandir().

But replacing scandir with my own equivalent might cause some problems.

@cabello
Copy link
Contributor

@cabello cabello commented Jul 15, 2012

I was having this issue, I sent you a pull request trying to help you to close it.

ggreer added a commit that referenced this issue Jul 16, 2012
First attempt to close issue #43
@ghost
Copy link

@ghost ghost commented Aug 6, 2012

Same problem here.

@ggreer
Copy link
Owner

@ggreer ggreer commented Aug 29, 2012

Ok, this should be fixed now.

@ggreer ggreer closed this Aug 29, 2012
@jmuheim
Copy link

@jmuheim jmuheim commented Aug 29, 2012

Thank you!

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.

4 participants
You can’t perform that action at this time.