Re: [PATCH] grep: --full-tree
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 25, 2009, 20:52 UTC
- Message-ID
- <7viqcytjic.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091125203922.GA18487@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Tue, Nov 24, 2009 at 12:56:32AM -0800, Junio C Hamano wrote: > >> * In http://article.gmane.org/gmane.comp.version-control.git/111717, I >> once argued in the opposite way, but I think it is Ok to aim for making >> the default --full-tree in the longer run (cf. $gmane/127885). This is >> the first step in that direction. > > Ironically, I argued for --full-tree behavior in the same thread, but > have since softened my view. What I have come to realize is that (for > me, anyway) it is very dependent on the organization of the project you > are working on.
I was against --full-tree but wished for it when I dipped my toe into somebody else's project and my itch lived in a directory a few levels deep, while the infrastructure the files in the directory uses were spread across global include directory and platform implementations [*1*].
And I agree that the preferred behaviour depends largely on both the project and what kind of change you are currently scratching.
So I think the posted patch alone without changing anything else would be the approach to give the most benefit with the least impact to existing users, at least for now.
> 2. It would be useful to have a "partial-tree" middle ground. In other > words, if I am in "linux/subproject/t", I would find it most > useful if "git grep" searched all of "linux/subproject".
"git grep -e frotz .." will work in your "from linux/subproject/t look for everywhere in linux/subproject", but if "/t" part were much longer and variable (iow you need to chdir around inside linux/subproject to scratch your itch) compared to "linux/subproject" part that is much shorter and static (to your work), it may make sense to give us a mode to specify pathspec from the top of the tree.
$ cd linux/subproject
$ cd foo
$ cd bar
$ cd baz
$ git grep --absolute-pathspec -e frotz -- linux/subprojectAs "git grep" never takes absolute paths, we _might_ be able to also do
$ git grep -e frotz -- /linux/subproject
to achieve the same.
[Footnote]
*1* It's rockbox, if you need to know.