help: add "show" as a valid configuration value

Add a literal value for showing the suggested autocorrection for consistency with the rest of the help.autocorrect options. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Feb 1, 2025 at 13:33 UTC e4542d8b35788c355164794457d46667378e9354
3 files changed +4 -2
Documentation/config/help.txt
+1 -1
@@ -11,7 +11,7 @@ help.autoCorrect::
11 If git detects typos and can identify exactly one valid command similar
12 to the error, git will try to suggest the correct command or even
13 run the suggestion automatically. Possible config values are:
14 - - 0, "false", "off", "no": show the suggested command (default).
14 + - 0, "false", "off", "no", "show": show the suggested command (default).
15 - 1, "true", "on", "yes", "immediate": run the suggested command
16 immediately.
17 - positive number > 1: run the suggested command after specified
help.c
+2
@@ -574,6 +574,8 @@ static int parse_autocorrect(const char *value)
574 return AUTOCORRECT_NEVER;
575 if (!strcmp(value, "immediate"))
576 return AUTOCORRECT_IMMEDIATELY;
577 + if (!strcmp(value, "show"))
578 + return AUTOCORRECT_SHOW;
579
580 return 0;
581 }
t/t9003-help-autocorrect.sh
+1 -1
@@ -28,7 +28,7 @@ test_expect_success 'setup' '
28 test_cmp expect actual
29 '
30
31 -for show in false no off 0
31 +for show in false no off 0 show
32 do
33 test_expect_success 'autocorrect showing candidates' '
34 git config help.autocorrect $show &&