Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Show usage string for 'git grep -h'
author
Jonathan Nieder
<jrnieder@gmail.com>
Mon, 9 Nov 2009 15:04:42 +0000
(09:04 -0600)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 10 Nov 2009 01:08:44 +0000
(17:08 -0800)
Clarification: the following description only talks about "git
grep -h" without any other options and arguments.
Such a change cannot be breaking backward compatibility. "grep
-h" cannot be asking for suppressing filenames, as there is no
match pattern specified.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
fe9a215
)
diff --git
a/builtin-grep.c
b/builtin-grep.c
index 1df25b07b573301bba7fdcb3b13d1af9050f513e..01be9bf7ff74731969384cc91dad2e20d08d81bc 100644
(file)
--- a/
builtin-grep.c
+++ b/
builtin-grep.c
@@
-788,6
+788,13
@@
int cmd_grep(int argc, const char **argv, const char *prefix)
OPT_END()
};
+ /*
+ * 'git grep -h', unlike 'git grep -h <pattern>', is a request
+ * to show usage information and exit.
+ */
+ if (argc == 2 && !strcmp(argv[1], "-h"))
+ usage_with_options(grep_usage, options);
+
memset(&opt, 0, sizeof(opt));
opt.prefix = prefix;
opt.prefix_length = (prefix && *prefix) ? strlen(prefix) : 0;