diff mbox series

[v3,13/13] builtin/config: display subcommand help

Message ID 657d1355b5d33056644effc5d170d323a58ebdbc.1711527812.git.ps@pks.im (mailing list archive)
State Accepted
Commit 7b91d310ce21aa663e025c8955c46c49ab037a41
Headers show
Series builtin/config: introduce subcommands | expand

Commit Message

Patrick Steinhardt March 27, 2024, 8:47 a.m. UTC
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>
---
 builtin/config.c            | 5 +++--
 t/t0450/txt-help-mismatches | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/builtin/config.c b/builtin/config.c
index b8cb940b1e..18b1f7014a 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -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
 };
 
@@ -1084,10 +1085,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);
 	}
 
diff --git a/t/t0450/txt-help-mismatches b/t/t0450/txt-help-mismatches
index a0777acd66..28003f18c9 100644
--- a/t/t0450/txt-help-mismatches
+++ b/t/t0450/txt-help-mismatches
@@ -10,7 +10,6 @@  checkout
 checkout-index
 clone
 column
-config
 credential
 credential-cache
 credential-store