From b821c999ca5cb472160a2ebb33aeeac5efc2fddc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 16 Jan 2025 13:35:51 -0800 Subject: builtins: send usage_with_options() help text to standard output Using the show_usage_with_options_if_asked() helper we introduced earlier, fix callers of usage_with_options() that want to show the help text when explicitly asked by the end-user. The help text now goes to the standard output stream for them. The test in t7600 for "git merge -h" may want to be retired, as the same is covered by t0012 already, but it is specifically testing that the "-h" option gets a response even with a corrupt index file, so for now let's leave it there. Acked-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/checkout-index.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'builtin/checkout-index.c') diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index a81501098d..e30086c7d4 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -250,9 +250,9 @@ int cmd_checkout_index(int argc, OPT_END() }; - if (argc == 2 && !strcmp(argv[1], "-h")) - usage_with_options(builtin_checkout_index_usage, - builtin_checkout_index_options); + show_usage_with_options_if_asked(argc, argv, + builtin_checkout_index_usage, + builtin_checkout_index_options); git_config(git_default_config, NULL); prefix_length = prefix ? strlen(prefix) : 0; -- cgit 1.2.3-korg