Skip to content

Commit c9fc748

Browse files
author
Junio C Hamano
committed
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>
1 parent dc56bc0 commit c9fc748

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-grep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ while : ; do
4040
shift
4141
done
4242
git-ls-files -z "${git_flags[@]}" "$@" |
43-
xargs -0 grep "${flags[@]}" "$pattern"
43+
xargs -0 grep "${flags[@]}" -e "$pattern"

0 commit comments

Comments
 (0)