Anonymous committed 2d9c572

fix usage string for git grep

Without this patch, git-grep gives confusing usage information:

$ git grep --confused
usage: git grep <option>* <rev>* [-e] <pattern> [<path>...]
$ git grep HEAD pattern
fatal: ambiguous argument 'pattern': unknown revision or path no
t in the working tree.
Use '--' to separate paths from revisions

So put <pattern> before the <rev>s, in accordance with actual correct
usage. While we're changing the usage string, we might as well include
the "--" separating revisions and paths, too.

Signed-off-by: Jonathan Nieder <>
Signed-off-by: Junio C Hamano <>

Comments (0)

Files changed (1)

 static const char builtin_grep_usage[] =
-"git-grep <option>* <rev>* [-e] <pattern> [<path>...]";
+"git-grep <option>* [-e] <pattern> <rev>* [[--] <path>...]";
 static const char emsg_invalid_context_len[] =
 "%s: invalid context length argument";