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>
This commit is contained in:
David Aguilar
2025-02-01 13:33:19 -08:00
committed by Junio C Hamano
parent e21bf2c431
commit e4542d8b35
3 changed files with 4 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ help.autoCorrect::
If git detects typos and can identify exactly one valid command similar
to the error, git will try to suggest the correct command or even
run the suggestion automatically. Possible config values are:
- 0, "false", "off", "no": show the suggested command (default).
- 0, "false", "off", "no", "show": show the suggested command (default).
- 1, "true", "on", "yes", "immediate": run the suggested command
immediately.
- positive number > 1: run the suggested command after specified

2
help.c
View File

@@ -574,6 +574,8 @@ static int parse_autocorrect(const char *value)
return AUTOCORRECT_NEVER;
if (!strcmp(value, "immediate"))
return AUTOCORRECT_IMMEDIATELY;
if (!strcmp(value, "show"))
return AUTOCORRECT_SHOW;
return 0;
}

View File

@@ -28,7 +28,7 @@ test_expect_success 'setup' '
test_cmp expect actual
'
for show in false no off 0
for show in false no off 0 show
do
test_expect_success 'autocorrect showing candidates' '
git config help.autocorrect $show &&