From: Jonathan Nieder Date: Mon, 9 Nov 2009 15:04:42 +0000 (-0600) Subject: Show usage string for 'git grep -h' X-Git-Tag: v1.6.6-rc0~34^2~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9c855c31786b9e879ef4cd3b8b5aa97bc4bcf8ec;p=git.git Show usage string for 'git grep -h' 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-grep.c b/builtin-grep.c index 1df25b07b..01be9bf7f 100644 --- 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 ', 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;