X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-grep.sh;h=44c16130bd93fea8b6f172f1614115801f8df2d9;hb=ee72aeaf009417156a3599b0eb69da3f7023ca07;hp=51924fd7c38a4fd70f59069a3eecbfe787626375;hpb=3db6b224cf36748b969acdd96b9fb2de641cd641;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"