summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:11 (GMT)
commit2d808073db276a447eb6d7e45afe47a363ff6bbe (patch)
tree0ed2394bd5dd0eac7f77963405e5023412fa2a3e /builtin/grep.c
parentc69d08df96ab784a61c9abaf81a632eea594e62b (diff)
parent42fdf86e5f6ecf675e973e3e4a08952c8b1fd4c4 (diff)
downloadgit-2d808073db276a447eb6d7e45afe47a363ff6bbe.zip
git-2d808073db276a447eb6d7e45afe47a363ff6bbe.tar.gz
git-2d808073db276a447eb6d7e45afe47a363ff6bbe.tar.bz2
Merge branch 'rs/parseopt-short-help'
Make "-h" command line option work more consistently in all commands. * rs/parseopt-short-help: show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP grep: stop using PARSE_OPT_NO_INTERNAL_HELP parse-options: allow -h as a short option parse-options: inline parse_options_usage() at its only remaining caller parse-options: deduplicate parse_options_usage() calls
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index d04f440..749e346 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -612,11 +612,6 @@ static int pattern_callback(const struct option *opt, const char *arg,
return 0;
}
-static int help_callback(const struct option *opt, const char *arg, int unset)
-{
- return -1;
-}
-
int cmd_grep(int argc, const char **argv, const char *prefix)
{
int hit = 0;
@@ -738,18 +733,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager },
OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored,
N_("allow calling of grep(1) (ignored by this build)")),
- { OPTION_CALLBACK, 0, "help-all", NULL, NULL, N_("show usage"),
- PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback },
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);
-
init_grep_defaults();
git_config(grep_cmd_config, NULL);
grep_init(&opt, prefix);
@@ -766,8 +752,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
*/
argc = parse_options(argc, argv, prefix, options, grep_usage,
PARSE_OPT_KEEP_DASHDASH |
- PARSE_OPT_STOP_AT_NON_OPTION |
- PARSE_OPT_NO_INTERNAL_HELP);
+ PARSE_OPT_STOP_AT_NON_OPTION);
grep_commit_pattern_type(pattern_type_arg, &opt);
if (use_index && !startup_info->have_repository)