@matheusbsbs / matheus-bagliano / commits / c9fc748f84
Fork 0

git-grep: fix 'git grep -e $pattern' handling

People typically say 'grep -e $pattern' because $pattern has a leading dash which would be mistaken as a grep flag. Make sure we pass -e in front of $pattern when we invoke grep. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 24, 2005 at 15:09 UTC c9fc748f84857a237f47deb91f87499e82865c83
1 file changed +1 -1
git-grep.sh
+1 -1
@@ -40,4 +40,4 @@ while : ; do
40 shift
41 done
42 git-ls-files -z "${git_flags[@]}" "$@" |
43 - xargs -0 grep "${flags[@]}" "$pattern"
43 + xargs -0 grep "${flags[@]}" -e "$pattern"