Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git-grep: option parsing conflicts with prefix-dash searches

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:11

Jan Engelhardt [off-list ref] writes:
On Saturday 2010-02-06 00:09, Jan Engelhardt wrote:
quoted
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..
quoted
As I said, it's a mess. And I know not whether any code can convince
the "but we need to watch compatibility"-sayers, because this would
definitely be a flag change.
I guess our mails crossed.  You don't have to worry about "flag change",
as I don't think there is any change necessary.

You just need to learn:

 (1) "-e" can come before a string to tell git: "this might look like
     an option to you but it isn't; it is what I am looking for"; and

 (2) Everything that follows "--" are pathspecs, not revs nor options.

And all is well.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help