Re: git grep argument parser bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dylan Grafmyre <dylang@xxxxxxxxxxxxxx> writes:

> 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"

I think you'd need to adjust your expectations, then ;-).

This is how "grep" (not "git grep") works, and you use "-e", i.e.

	grep -e "-anything that begins with a dash" FILES...

to disambiguate.  If you are scripting, if you do not know what you
have in a variable, and if you are looking for the value in that
variable, you would always do

	grep -e "$variable" FILES...

not

        grep "$variable" FILES...

I think all of the above is pretty much the standard practice and
"git grep" merely follows suit, i.e.

	git grep -e "-help"

is designed to work that way to match users' expectations.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]