help: correct logic error in combining --all and --guides

The --all and --guides commands could be combined, which wouldn't have any impact on the output except for: git help --all --guides --no-verbose Listing the guide alongside that output was clearly not intended, so let's error out here. See 002b726a400 (builtin/help.c: add list_common_guides_help() function, 2013-04-02) for the initial implementation. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 22, 2021 at 00:40 UTC 0a5940fbe7e453652266e765509a576e4df333c7
2 files changed +10 -1
builtin/help.c
+4
@@ -559,6 +559,10 @@ int cmd_help(int argc, const char **argv, const char *prefix)
559 usage_msg_opt(_("--config and --all cannot be combined"),
560 builtin_help_usage, builtin_help_options);
561
562 + if (show_all && show_guides)
563 + usage_msg_opt(_("--config and --guides cannot be combined"),
564 + builtin_help_usage, builtin_help_options);
565 +
566 if (show_config && show_guides)
567 usage_msg_opt(_("--config and --guides cannot be combined"),
568 builtin_help_usage, builtin_help_options);
t/t0012-help.sh
+6 -1
@@ -36,7 +36,12 @@ test_expect_success 'basic help commands' '
36
37 test_expect_success 'invalid usage' '
38 test_expect_code 129 git help -g add &&
39 - test_expect_code 129 git help -a -c
39 + test_expect_code 129 git help -a -c &&
40 +
41 + test_expect_code 129 git help -g add &&
42 + test_expect_code 129 git help -a -g &&
43 +
44 + test_expect_code 129 git help -g -c
45 '
46
47 test_expect_success "works for commands and guides by default" '