Skip to content

Commit

Permalink
builtin/config: display subcommand help
Browse files Browse the repository at this point in the history
Until now, `git config -h` would have printed help for the old-style
syntax. Now that all modes have proper subcommands though it is
preferable to instead display the subcommand help.

Drop the `NO_INTERNAL_HELP` flag to do so. While at it, drop the help
mismatch in t0450 and add the `--get-colorbool` option to the usage such
that git-config(1)'s synopsis and `git config -h` match.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
pks-t authored and gitster committed May 3, 2024
1 parent 203eb4d commit 44c7fb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions builtin/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static const char *const builtin_config_usage[] = {
N_("git config rename-section [<file-option>] <old-name> <new-name>"),
N_("git config remove-section [<file-option>] <name>"),
N_("git config edit [<file-option>]"),
N_("git config [<file-option>] --get-colorbool <name> [<stdout-is-tty>]"),
NULL
};

Expand Down Expand Up @@ -1093,10 +1094,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
* us when parsing the legacy-style modes that don't use subcommands.
*/
argc = parse_options(argc, argv, prefix, builtin_subcommand_options, builtin_config_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_NO_INTERNAL_HELP|PARSE_OPT_KEEP_ARGV0|PARSE_OPT_KEEP_UNKNOWN_OPT);
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_ARGV0|PARSE_OPT_KEEP_UNKNOWN_OPT);
if (subcommand) {
argc = parse_options(argc, argv, prefix, builtin_subcommand_options, builtin_config_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_NO_INTERNAL_HELP|PARSE_OPT_KEEP_UNKNOWN_OPT);
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_UNKNOWN_OPT);
return subcommand(argc, argv, prefix);
}

Expand Down
1 change: 0 additions & 1 deletion t/t0450/txt-help-mismatches
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ checkout
checkout-index
clone
column
config
credential
credential-cache
credential-store
Expand Down

0 comments on commit 44c7fb7

Please sign in to comment.