git grep argument parser bug

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

git grep argument parser bug

From: Dylan Grafmyre <hidden>
Date: 2016-06-15 23:08:06

In both ubuntu versions of git 1.9.1 and 2.7.0

    git grep '-test'
    git grep '--help'

Or any other expressions literal leading with a single dash or double
dash get interpreted as argument flags and not as search expressions.

What I expect is grep results for the literal strings "-test" and "--help"
What i get is git help output informing of wrong argument usage, or
accidentally turning on flags I didn't expect.

Work around; for afflicted users terminating argument parsing with `
-- ` works as it should.

    git grep -- '-test'

Confirmed on two Ubuntu [based] systems, Ubuntu Server 14.03 and
LinuxMint 17.3 [Cinnamon]

-- 
Dylan Grafmyre
Associate System Administrator

Email: DylanG@conversica.com
Office: +1 (888) 778 1004
Web:   www.conversica.com

Re: git grep argument parser bug

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:08:06

On Fri, Feb 5, 2016 at 5:02 AM, Dylan Grafmyre [off-list ref] wrote:
In both ubuntu versions of git 1.9.1 and 2.7.0

    git grep '-test'
    git grep '--help'
(Un)Quoting is done by shell and stripped out before "git" is
executed. We just don't see them.
Or any other expressions literal leading with a single dash or double
dash get interpreted as argument flags and not as search expressions.

What I expect is grep results for the literal strings "-test" and "--help"
What i get is git help output informing of wrong argument usage, or
accidentally turning on flags I didn't expect.

Work around; for afflicted users terminating argument parsing with `
-- ` works as it should.

    git grep -- '-test'
Or you can do "git grep -e --test". UNIX grep faces the same problem,
and also has -e to deal with it.
Confirmed on two Ubuntu [based] systems, Ubuntu Server 14.03 and
LinuxMint 17.3 [Cinnamon]
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help