git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <santi@agolina.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: git@vger.kernel.org
Subject: Re: git-grep: option parsing conflicts with prefix-dash searches
Date: Sat, 6 Feb 2010 00:27:19 +0100	[thread overview]
Message-ID: <adf1fd3d1002051527j72fd302byc85a2f0980ce9998@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.01.1002060009430.30204@obet.zrqbmnf.qr>

On Sat, Feb 6, 2010 at 12:17 AM, Jan Engelhardt <jengelh@medozas.de> wrote:
> On Saturday 2010-02-06 00:09, Jan Engelhardt wrote:
>
>>What works is (3).
>>
>>(3)    $ git grep -- -- '->cnt' net/ipv4/netfilter/
>
> No, I spoke too soon. This command will search for --, not ->cnt.
> So git cannot search for patterns starting with a dash at all,
> as I see it. This is getting fun..

You should use -e:

     -e
           The next parameter is the pattern. This option has to be
used for patterns starting with - and should be used in scripts
passing user input to grep.

The working command is:

$ git grep -e '->cnt' net/ipv4/netfilter/

Although there is not such pattern in net/ipv4/netfilter, maybe you
wanted '->counters' :-)

HTH,
Santi

  reply	other threads:[~2010-02-05 23:27 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 [this message]
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
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=adf1fd3d1002051527j72fd302byc85a2f0980ce9998@mail.gmail.com \
    --to=santi@agolina.net \
    --cc=git@vger.kernel.org \
    --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).