From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] grep: --full-tree
Date: Wed, 25 Nov 2009 13:33:22 -0800 [thread overview]
Message-ID: <7vmy2as319.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20091125210034.GC18487@coredump.intra.peff.net> (Jeff King's message of "Wed\, 25 Nov 2009 16\:00\:34 -0500")
Jeff King <peff@peff.net> writes:
> On Wed, Nov 25, 2009 at 12:52:11PM -0800, Junio C Hamano wrote:
>
>> 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.
>
> Yes, I meant to say in my original message but forgot to: I think
> --full-tree is an important first step, no matter what happens next. It
> gives people a way to do what they want without typing the right number
> of ".."s, and it opens up --no-full-tree if the default changes later.
>
> But I do worry about it being a command-line option. You are asking the
> user to remember to type --full-tree every time.
We could redefine get_pathspec() to treat a pathspec that begins with a
slash to be anchored at the top, i.e.
$ git grep -e frotz /
would be a nicer way to spell
$ git grep --full-tree -e frotz
and allows you more than what you can do with --full-tree, e.g.
$ cd linux/subtree/some/very/deep/subdir/you/do/not/remember/exactly
$ git grep -e frotz /linux/subtree
If we do that, it will not be limited to "grep" but would bring uniformity
to the command set [*1*]. Of course, you can keep doing
$ cd t
$ git grep -e frotz .
to look inside only the current directory, and once this new convention is
accepted and widely used, it would become possible to flip the default
without causing too much pain (yes, I am agreeing with you that this is an
important first step).
Once there is a convenient and uniform way to ask for either behaviour, no
matter what the default is, the scripts that want specific behaviour can
be updated to choose whichever they want, given enough time (say, 2.0.0).
> Certainly I think that would be an improvement. But again, it suffers
> from the "you must remember to do this" as above. I really want "git
> grep" to Do What I Mean.
And /this-is-absolute is one way to tell "grep" What You Mean. I do not
claim it would be the _best_ way (I just concocted it up a few minutes ago
without giving it deep thought). Do you have a better alternative in
mind?
> I have to wonder: is "git grep" really plumbing or porcelain? It is
> really just a wrapper for
>
> git ls-files | xargs grep
>
> Do people actually use it in their scripts? Should they be?
The issue is not necessarily "scripts", but "what people use the output
for".
My earlier "push is excusable" was primarily because "push" tends to be
the _final_ action in the chain of events, as opposed to "ls-files" and
"grep" output that are meant to be used by the user to _decide_ what to
do next depending on what they find, and as such, the latter has more
problem if they changed behaviour based on the configuration.
[Footnote]
*1* It won't be only get_pathspec(), but we would also need to teach
verify_filename() and verify_non_filename() about the new convention.
next prev parent reply other threads:[~2009-11-25 21:33 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-24 8:56 [PATCH] grep: --full-tree Junio C Hamano
2009-11-25 13:16 ` Michael J Gruber
2009-11-25 19:32 ` Junio C Hamano
2009-11-25 14:56 ` Sverre Rabbelier
2009-11-25 19:32 ` Junio C Hamano
2009-11-25 20:19 ` Sverre Rabbelier
2009-11-25 20:23 ` Junio C Hamano
2009-11-25 20:46 ` Sverre Rabbelier
2009-11-25 23:31 ` Johannes Schindelin
2009-11-25 23:29 ` Sverre Rabbelier
2009-11-25 20:52 ` Jeff King
2009-11-25 20:39 ` Jeff King
2009-11-25 20:52 ` Junio C Hamano
2009-11-25 21:00 ` Jeff King
2009-11-25 21:33 ` Junio C Hamano [this message]
2009-11-25 21:49 ` Jeff King
2009-11-25 22:12 ` James Pickens
2009-11-25 22:20 ` Jeff King
2009-11-26 17:56 ` James Pickens
2009-11-27 6:20 ` Jeff King
2009-11-27 8:18 ` Junio C Hamano
2009-11-27 9:31 ` Johannes Schindelin
2009-11-27 9:59 ` Jeff King
2009-11-27 10:53 ` Johannes Schindelin
2009-11-27 16:27 ` Uri Okrent
2009-11-27 18:29 ` Junio C Hamano
2009-11-27 18:47 ` Uri Okrent
2009-11-27 20:53 ` Jeff King
2009-11-29 19:50 ` Uri Okrent
2009-11-29 11:48 ` Felipe Contreras
2009-11-27 18:02 ` Jeff King
2009-11-27 20:07 ` Johannes Schindelin
2009-11-27 21:05 ` Jeff King
2009-11-29 10:28 ` Johannes Schindelin
2009-11-29 18:32 ` Jeff King
2009-11-29 19:49 ` Junio C Hamano
2009-11-29 12:13 ` Felipe Contreras
2009-11-27 18:29 ` Junio C Hamano
2009-11-27 20:50 ` Jeff King
2009-11-29 10:21 ` Johannes Schindelin
2009-11-29 18:24 ` Jeff King
2009-11-27 10:37 ` Matthieu Moy
2009-11-27 10:56 ` Johannes Schindelin
2009-11-25 22:26 ` Wincent Colaiuta
2009-11-26 0:00 ` Junio C Hamano
2009-11-26 0:16 ` A Large Angry SCM
2009-11-26 0:20 ` Junio C Hamano
2009-11-26 0:30 ` A Large Angry SCM
2009-11-26 0:36 ` Junio C Hamano
2009-11-26 18:14 ` James Pickens
2009-11-25 22:19 ` Junio C Hamano
2009-11-25 22:26 ` Jeff King
2009-11-25 22:41 ` A Large Angry SCM
2009-11-25 22:53 ` Jeff King
2009-11-25 23:07 ` A Large Angry SCM
2009-11-25 23:22 ` Jeff King
2009-11-29 11:38 ` Felipe Contreras
2009-11-29 19:45 ` Uri Okrent
2009-11-26 0:02 ` Junio C Hamano
2009-11-27 6:22 ` Jeff King
2009-11-25 22:15 ` A Large Angry SCM
2009-11-25 22:21 ` Junio C Hamano
2009-11-25 22:31 ` A Large Angry SCM
2009-11-25 22:43 ` A Large Angry SCM
2009-11-25 23:34 ` Johannes Schindelin
2009-11-25 23:41 ` Junio C Hamano
2009-11-26 0:04 ` Johannes Schindelin
2009-11-26 0:13 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vmy2as319.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).