Phil Hord venit, vidit, dixit 28.02.2011 23:25: > (cc list: Pardon this duplicate attempt) > > On 02/28/2011 04:27 AM, Michael J Gruber wrote: >> David Chanters venit, vidit, dixit 28.02.2011 01:17: >>>> Hi all, >>>> >>>> [ Please Cc me as I am not subscribed to this list, thanks. ] >>>> >>>> I'm wondering if there's an easy way to get git-grep (and I suppose >>>> other commands which operate on a per-repository level rather than >>>> per-tree) to work across the whole repository? >> git grep -- $(git rev-parse --show-cdup) >> >> is the best we have right now. I think we're still looking for a good >> way to denote "root of repo" (like "." for cwd). >> >> Also, we're thinking of changing a few defaults (to repo-wide), but "git >> grep" is meant to stay close to ordinary grep. > > But git grep is different than grep in exactly the "files selection" > area. With grep, I always have to specify the files to search. With > git-grep, I don't. > > Oridinary grep with no paths fails (reads stdin), so when I make this > mistake it is always immediately evident. I retry the command with > paths/wildcards. But git-grep with no path "works" and I am likely to > forget that it worked only on my $PWD. > > git-grep also includes subdirectories and excludes untracked files by > default. This makes git-grep feel like the "repository grep" tool that > it is. The fact that it does _not_ search from the top of the repository > by default seems (to me) to be the only oddball case. > > I would be much more comfortable with David's proposed option turned on > always. When I want to search "here", I can add a dot. > > git grep foo # search the whole repository > git grep foo -- . # Search only from $PWD > > Maybe it's dangerous as an always-on option, as it can break scripts. > And I'd be happy-ish even with a --full-tree option. But I think I > would eventually alias it so it always does what I expect. > > I know that's not what the original question was, but it's the behavior > I often erroneously expect. I would love "git grep" to be repowise, with the simple "git grep ." to make it relative to cwd. We've discussed making more commands repowise, and the consensus (which I've stated above, accepting the majority vote) was that some should stay, e.g. git-grep. The discussion started with <http://permalink.gmane.org/gmane.comp.version-control.git/166135> and the consensus is stated here: <http://permalink.gmane.org/gmane.comp.version-control.git/167149> This does not prevent you from submitting a "--full-tree" patch for git-grep, of course. Michael -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html