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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 6, 2024 at 10:56 UTC
7b91d310ce21aa663e025c8955c46c49ab037a41
2 files changed
+3
-3
builtin/config.c
+3
-2
@@ -23,6 +23,7 @@ static const char *const builtin_config_usage[] = {
23
N_("git config rename-section [<file-option>] <old-name> <new-name>"),
24
N_("git config remove-section [<file-option>] <name>"),
25
N_("git config edit [<file-option>]"),
26
+ N_("git config [<file-option>] --get-colorbool <name> [<stdout-is-tty>]"),
27
NULL
28
};
29
@@ -1093,10 +1094,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
1094
* us when parsing the legacy-style modes that don't use subcommands.
1095
*/
1096
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);
1098
if (subcommand) {
1099
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);
1101
return subcommand(argc, argv, prefix);
1102
}
1103
t/t0450/txt-help-mismatches
-1
@@ -10,7 +10,6 @@ checkout
10
checkout-index
11
clone
12
column
13
-config
13
credential
14
credential-cache
15
credential-store