threads / patch / 14549

patchfix usage string for git grep

Subject: [PATCH] fix usage string for git grep

## tl;dr

One message between Jul 20, 2008 and Jul 20, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Jonathan Nieder· Jul 20, 2008, 19:13 UTC · lore
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 <jrnieder@uchicago.edu>
---
	Thanks!
 builtin-grep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to builtin-grep.c +1 −1
diff --git a/builtin-grep.c b/builtin-grep.c
index 7bf6a71..631129d 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -498,7 +498,7 @@ static int grep_object(struct grep_opt *opt, const char **paths,
 }
 
 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";
-- 
1.5.6.4.441.g4b4e9

← back to recent threads