author | Jeff King <peff@peff.net> | |
Sun, 7 Feb 2010 04:44:15 +0000 (23:44 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 7 Feb 2010 23:53:54 +0000 (15:53 -0800) | ||
commit | 1123c67ceee2f310b08ab5d67b076ef04ab59bfc | |
tree | ebebcecbee1f010a1f073bd9bcb59e1e87af5b0d | tree | snapshot |
parent | 3c8f6c8c4f00414e66076c2c97c834d01f828491 | commit | diff |
accept "git grep -- pattern"
Currently the only way to "quote" a grep pattern that might
begin with a dash is to use "git grep -e pattern". This
works just fine, and is also the way right way to do it on
many traditional grep implemenations.
Some people prefer to use "git grep -- pattern", however, as
"--" is the usual "end of options" marker, and at least GNU
grep and Solaris 10 grep support this. This patch makes that
syntax work.
There is a slight behavior change, in that "git grep -- $X"
used to be interpreted as "grep for -- in $X". However, that
usage is questionable. "--" is usually the end-of-options
marker, so "git grep" was unlike many other greps in
treating it as a literal pattern (e.g., both GNU grep and
Solaris 10 grep will treat "grep --" as missing a pattern).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently the only way to "quote" a grep pattern that might
begin with a dash is to use "git grep -e pattern". This
works just fine, and is also the way right way to do it on
many traditional grep implemenations.
Some people prefer to use "git grep -- pattern", however, as
"--" is the usual "end of options" marker, and at least GNU
grep and Solaris 10 grep support this. This patch makes that
syntax work.
There is a slight behavior change, in that "git grep -- $X"
used to be interpreted as "grep for -- in $X". However, that
usage is questionable. "--" is usually the end-of-options
marker, so "git grep" was unlike many other greps in
treating it as a literal pattern (e.g., both GNU grep and
Solaris 10 grep will treat "grep --" as missing a pattern).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c | diff | blob | history | |
t/t7002-grep.sh | diff | blob | history |