diff options
author | Linus Torvalds <torvalds@osdl.org> | 2005-11-16 09:38:46 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-11-16 13:17:46 -0800 |
commit | c0c35d5e419f3bf215103b1e26359aca288c2113 (patch) | |
tree | bf4e2dd133be0adb04b35f7cceec6733f4324e7c /git-grep.sh | |
parent | git wrapper: basic fixes. (diff) | |
download | tgif-c0c35d5e419f3bf215103b1e26359aca288c2113.tar.xz |
Disallow empty pattern in "git grep"
For some reason I've done a "git grep" twice with no pattern, which is
really irritating, since it just grep everything. If I actually wanted
that, I could do "git grep ^" or something.
So add a "usage" message if the pattern is empty.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-grep.sh')
-rwxr-xr-x | git-grep.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-grep.sh b/git-grep.sh index e7a35ebd70..44c16130bd 100755 --- a/git-grep.sh +++ b/git-grep.sh @@ -39,5 +39,9 @@ while : ; do esac shift done +[ "$pattern" ] || { + echo >&2 "usage: 'git grep <pattern> [pathspec*]'" + exit 1 +} git-ls-files -z "${git_flags[@]}" "$@" | xargs -0 grep "${flags[@]}" -e "$pattern" |