X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-grep.sh;h=44c16130bd93fea8b6f172f1614115801f8df2d9;hb=4275df517022604f5c33ba05ae45a885b84e3472;hp=51924fd7c38a4fd70f59069a3eecbfe787626375;hpb=5d9d831a51dc7847ad40fac77f9a072aa2d1c0bd;p=git.git diff --git a/git-grep.sh b/git-grep.sh index 51924fd7..44c16130 100755 --- a/git-grep.sh +++ b/git-grep.sh @@ -39,5 +39,9 @@ while : ; do esac shift done +[ "$pattern" ] || { + echo >&2 "usage: 'git grep [pathspec*]'" + exit 1 +} git-ls-files -z "${git_flags[@]}" "$@" | - xargs -0 grep "${flags[@]}" "$pattern" + xargs -0 grep "${flags[@]}" -e "$pattern"