author | Junio C Hamano <junkio@cox.net> | |
Tue, 9 May 2006 06:55:47 +0000 (23:55 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 9 May 2006 06:55:47 +0000 (23:55 -0700) | ||
commit | 5acd64edec37a7d9783af1a2be99772d466e8f02 | |
tree | 5cfc7699a2e5ac229ca34098489666f2971b104a | tree | snapshot |
parent | 1c57119c70332faf206b5c7e2f3639b96a221717 | commit | diff |
builtin-grep: tighten argument parsing.
I mistyped
git grep next -e '"^@"' '*.c'
and got many hits that contain "next" without complaint.
Obviously what I meant to say was:
git grep -e '"^@"' next -- '*.c'
This tightens the argument parsing rule a bit:
- All "grep" parameters should come first;
- If there is no -e nor -f to specify pattern, the first non
option string is the parameter;
- After that, zero or more revs can follow.
- An optional '--' can be present, and is skipped.
- All the rest are pathspecs. If '--' was not there, they must
be paths that exist in the working tree.
Signed-off-by: Junio C Hamano <junkio@cox.net>
I mistyped
git grep next -e '"^@"' '*.c'
and got many hits that contain "next" without complaint.
Obviously what I meant to say was:
git grep -e '"^@"' next -- '*.c'
This tightens the argument parsing rule a bit:
- All "grep" parameters should come first;
- If there is no -e nor -f to specify pattern, the first non
option string is the parameter;
- After that, zero or more revs can follow.
- An optional '--' can be present, and is skipped.
- All the rest are pathspecs. If '--' was not there, they must
be paths that exist in the working tree.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-grep.c | diff | blob | history |