From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jan Engelhardt <jengelh@medozas.de>, git@vger.kernel.org
Subject: Re: git-grep: option parsing conflicts with prefix-dash searches
Date: Sat, 6 Feb 2010 06:58:17 -0500 [thread overview]
Message-ID: <20100206115817.GA11605@sigill.intra.peff.net> (raw)
In-Reply-To: <7v7hqrdkxb.fsf@alter.siamese.dyndns.org>
On Fri, Feb 05, 2010 at 08:53:36PM -0800, Junio C Hamano wrote:
> > git grep -- pattern revision -- pathname
> [...]
> I don't think if "ambiguous or not" is what we are after to begin with.
>
> I have known GNU extended grep implementations long enough but never saw
> that "--" used to quote a pattern. Is it worth supporting to begin with?
I think so. It was the first thing the original poster in this thread
tried. It is also something I have tried (and still do, then grumblingly
retype "-e pattern"). And it certainly makes sense from a user
perspective; it is the same end-of-options signal that most other
programs take.
So I think it is a convenient interface improvement, nothing more. If it
were somehow onerous to support, I would say that no, it is not worth
it. But it really is only a few lines of code, and I do not think the
behavior change is hurting any real-world cases (which is what I was
trying to show earlier).
I suspect you are not familiar with it because you are enough of an
old-timer to have worked with the many non-GNU greps that require "-e"
to specify a funny pattern and so got used to that habit.
> I would say "git grep -- pattern" is sufficiently insane enough that
> I'm not worried about it at all. Interpreting "git grep --" as a request
> to look for double-dash feels million times saner than that, actually.
I don't think "grep --" is sane at all, since it is broken under GNU
grep. And because "--" is a special token in option parsing, I would
expect it to need "git grep -e --".
> Unless somebody comes up with example of that pattern's wide use. Point
> me to some well known open source software's source trees that use "--"
> for such a purpose in one of its shell script or Makefile.
OK. Try:
http://www.google.com/codesearch?hl=en&sa=N&q=grep.*%5Cs--%5Cs++lang:shell&ct=rr&cs_r=lang:shell
Some are false positives, but it looks like libtool's generated
configure scripts use it (which is in literally hundreds of projects),
openssh's fixpaths script, ffmpeg's configure script, even a use in a
plan9 script.
And that's just the first page of results. So I think I am not the only
one.
-Peff
next prev parent reply other threads:[~2010-02-06 12:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-05 23:09 git-grep: option parsing conflicts with prefix-dash searches Jan Engelhardt
2010-02-05 23:17 ` Jan Engelhardt
2010-02-05 23:27 ` Santi Béjar
2010-02-05 23:34 ` Junio C Hamano
2010-02-05 23:31 ` Junio C Hamano
2010-02-06 3:51 ` Jeff King
2010-02-06 4:53 ` Junio C Hamano
2010-02-06 8:17 ` Miles Bader
2010-02-06 11:58 ` Jeff King [this message]
2010-02-06 17:39 ` Junio C Hamano
2010-02-07 4:44 ` Jeff King
2010-02-08 1:06 ` 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=20100206115817.GA11605@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jengelh@medozas.de \
/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).