Browse Source

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>
maint
Junio C Hamano 19 years ago
parent
commit
c9fc748f84
  1. 2
      git-grep.sh

2
git-grep.sh

@ -40,4 +40,4 @@ while : ; do @@ -40,4 +40,4 @@ while : ; do
shift
done
git-ls-files -z "${git_flags[@]}" "$@" |
xargs -0 grep "${flags[@]}" "$pattern"
xargs -0 grep "${flags[@]}" -e "$pattern"

Loading…
Cancel
Save