]> git.ipfire.org Git - thirdparty/git.git/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 676ba3a55f75a44d3db301555f8e982c1f692c02..b369589cec9474d0af5c17466038e4fa43415987 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 55425c0d9789405a3bb3feb00b79e5816ad8c13a..8d91afe851d1f70ec67d31f759339ae84a0a0977 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 5ebfc00f523d69760f368b0c0ab974136b1fc0e6..8da318d2b543da2b7f182fb972d847ba9838a1e3 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 &&