]> Kevux Git Server - rit/commitdiff
help: add "show" as a valid configuration value
authorDavid Aguilar <davvid@gmail.com>
Sat, 1 Feb 2025 21:33:19 +0000 (13:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Feb 2025 23:22:05 +0000 (15:22 -0800)
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>
Documentation/config/help.txt
help.c
t/t9003-help-autocorrect.sh

index 676ba3a..b369589 100644 (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
diff --git a/help.c b/help.c
index 55425c0..8d91afe 100644 (file)
--- a/help.c
+++ b/help.c
@@ -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;
 }
index 5ebfc00..8da318d 100755 (executable)
@@ -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 &&