Skip to content

Commit 7b91d31

Browse files
pks-tgitster
authored andcommitted
builtin/config: display subcommand help
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3cbace5 commit 7b91d31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin/config.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static const char *const builtin_config_usage[] = {
2323
N_("git config rename-section [<file-option>] <old-name> <new-name>"),
2424
N_("git config remove-section [<file-option>] <name>"),
2525
N_("git config edit [<file-option>]"),
26+
N_("git config [<file-option>] --get-colorbool <name> [<stdout-is-tty>]"),
2627
NULL
2728
};
2829

@@ -1093,10 +1094,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
10931094
* us when parsing the legacy-style modes that don't use subcommands.
10941095
*/
10951096
argc = parse_options(argc, argv, prefix, builtin_subcommand_options, builtin_config_usage,
1096-
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_NO_INTERNAL_HELP|PARSE_OPT_KEEP_ARGV0|PARSE_OPT_KEEP_UNKNOWN_OPT);
1097+
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_ARGV0|PARSE_OPT_KEEP_UNKNOWN_OPT);
10971098
if (subcommand) {
10981099
argc = parse_options(argc, argv, prefix, builtin_subcommand_options, builtin_config_usage,
1099-
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_NO_INTERNAL_HELP|PARSE_OPT_KEEP_UNKNOWN_OPT);
1100+
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_UNKNOWN_OPT);
11001101
return subcommand(argc, argv, prefix);
11011102
}
11021103

t/t0450/txt-help-mismatches

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ checkout
1010
checkout-index
1111
clone
1212
column
13-
config
1413
credential
1514
credential-cache
1615
credential-store

0 commit comments

Comments
 (0)