Skip to content

Commit 0a5940f

Browse files
avargitster
authored andcommitted
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 002b726 (builtin/help.c: add list_common_guides_help() function, 2013-04-02) for the initial implementation. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ed4bef commit 0a5940f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

builtin/help.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ int cmd_help(int argc, const char **argv, const char *prefix)
559559
usage_msg_opt(_("--config and --all cannot be combined"),
560560
builtin_help_usage, builtin_help_options);
561561

562+
if (show_all && show_guides)
563+
usage_msg_opt(_("--config and --guides cannot be combined"),
564+
builtin_help_usage, builtin_help_options);
565+
562566
if (show_config && show_guides)
563567
usage_msg_opt(_("--config and --guides cannot be combined"),
564568
builtin_help_usage, builtin_help_options);

t/t0012-help.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ test_expect_success 'basic help commands' '
3636

3737
test_expect_success 'invalid usage' '
3838
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
4045
'
4146

4247
test_expect_success "works for commands and guides by default" '

0 commit comments

Comments
 (0)