-
Notifications
You must be signed in to change notification settings - Fork 112
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
Ignore behavior differs from git and ag #118
Comments
The
The git documentation points out that directories are specified with a trailing slash Ugrep is more sensitive to distinguish files from directories, which gives you a bit more power to specifically ignore files and/or ignore directories. This should cause fewer (unpleasant) surprises that entire directories are ignored, because the directory names happen to accidentally match the file globs. This distinction in ugrep comes from option We could change ugrep to ignore |
Thanks @genivia-inc, the reasoning makes sense to me. I don't have an opinion about which behavior is better, and I'm fine with changing |
Works like a charm. |
Ha, you're right— I hadn't provided |
I'm not sure I agree with the reading of the
This means that ignoring
I'd say documenting this divergence (or offering a command line option to support gitignore format fully) is reasonable. I understand if you find the current behavior more reasonable as a default. I can open another issue if you'd like, but this one seemed recent enough for me to bring it up. |
It is not that I personally find the current behavior more reasonable, it is a matter of safety (nothing went accidentally missing in the results) and POLS (principle of least surprise). You'll hear people say "I'm surprised that simple patterns like Judging from these comments and other more serious issues, git made a mistake to ignore both files and directories with a plain glob pattern. 1) Ignoring only files that match a glob
That is incorrect. Symlinked directories are directories, not files. So if We need to be careful. Keeping things this way feels a whole lot safer and predictable and is still compatible with git, since git understands |
I might not have been clear, it's
Though I don't agree with it entirely, I do understand your reasoning here. I'd suggest that documenting the limitation is enough and adds less moving pieces to |
A
and also:
Likewise, The
|
Looks good to me, thanks! |
Just tried to use My point is pretty simple. I simply can't update Feel free to ignore this comment. And thanks for the great program. |
I have been thinking about this for a while now. I tend to agree it's better to replicate .gitignore behavior since that's what is expected. But only for these files. So we can keep the grep-based A change will make the documentation a bit more convoluted perhaps, since there will be two sets of rules. PS. or should the rules be applied "gitignore-style" to all |
The change would be reflected in the man page and help:
where it suffices to say that "Globbing syntax is the same as the --exclude-from=FILE gitignore syntax, but files and directories are excluded instead of only files". |
I have no strong opinion about other Thank you. |
Possibly a bug in my expectations rather than the code.
Given this directory:
$ tree -a -I .git . ├── foo │ ├── bar │ │ └── world.txt │ └── world.txt └── .gitignore 2 directories, 3 files
With these files:
And this
.gitignore
:Git ignores
bar
:And so does
ag
:But
ugrep
doesn't:Is it intended?
Version:
The text was updated successfully, but these errors were encountered: