Skip to content

Commit 42fdf86

Browse files
rscharfepeff
authored andcommitted
show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP
The flag PARSE_OPT_NO_INTERNAL_HELP is set to allow overriding the option -h, except when it's the only one given. This is the default behavior now, so remove the flag and the hand-rolled --help-all handling. The internal --help-all handler now actually shows hidden options, i.e. -h in this case. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 4441549 commit 42fdf86

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

builtin/show-ref.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ static int exclude_existing_callback(const struct option *opt, const char *arg,
161161
return 0;
162162
}
163163

164-
static int help_callback(const struct option *opt, const char *arg, int unset)
165-
{
166-
return -1;
167-
}
168-
169164
static const struct option show_ref_options[] = {
170165
OPT_BOOL(0, "tags", &tags_only, N_("only show tags (can be combined with heads)")),
171166
OPT_BOOL(0, "heads", &heads_only, N_("only show heads (can be combined with tags)")),
@@ -186,18 +181,13 @@ static const struct option show_ref_options[] = {
186181
{ OPTION_CALLBACK, 0, "exclude-existing", &exclude_existing_arg,
187182
N_("pattern"), N_("show refs from stdin that aren't in local repository"),
188183
PARSE_OPT_OPTARG | PARSE_OPT_NONEG, exclude_existing_callback },
189-
{ OPTION_CALLBACK, 0, "help-all", NULL, NULL, N_("show usage"),
190-
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback },
191184
OPT_END()
192185
};
193186

194187
int cmd_show_ref(int argc, const char **argv, const char *prefix)
195188
{
196-
if (argc == 2 && !strcmp(argv[1], "-h"))
197-
usage_with_options(show_ref_usage, show_ref_options);
198-
199189
argc = parse_options(argc, argv, prefix, show_ref_options,
200-
show_ref_usage, PARSE_OPT_NO_INTERNAL_HELP);
190+
show_ref_usage, 0);
201191

202192
if (exclude_arg)
203193
return exclude_existing(exclude_existing_arg);

0 commit comments

Comments
 (0)