summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7dbc2c0)
raw | patch | inline | side by side (parent: 7dbc2c0)
author | Linus Torvalds <torvalds@osdl.org> | |
Wed, 16 Nov 2005 17:38:46 +0000 (09:38 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 Nov 2005 21:17:46 +0000 (13:17 -0800) |
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>
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>
git-grep.sh | patch | blob | history |
diff --git a/git-grep.sh b/git-grep.sh
index e7a35ebd707c6ef485a26f4e1ece57fa248e0106..44c16130bd93fea8b6f172f1614115801f8df2d9 100755 (executable)
--- a/git-grep.sh
+++ b/git-grep.sh
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"