]> git.ipfire.org Git - thirdparty/git.git/commitdiff
autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINT
authorJiamu Sun <39@barroit.sh>
Mon, 16 Mar 2026 15:36:18 +0000 (00:36 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Mar 2026 18:21:08 +0000 (11:21 -0700)
AUTOCORRECT_SHOW is ambiguous. Its purpose is to show commands similar
to the unknown one and take no other action. Rename it to fit the
semantics.

Signed-off-by: Jiamu Sun <39@barroit.sh>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
autocorrect.c
autocorrect.h
help.c

index 2484546fc731d9ad3a28cebce0faa190fef65024..de0fa282c934a86a5296ad54940df7c07ae13f58 100644 (file)
@@ -12,7 +12,7 @@ static enum autocorrect_mode parse_autocorrect(const char *value)
        case 1:
                return AUTOCORRECT_IMMEDIATELY;
        case 0:
-               return AUTOCORRECT_SHOW;
+               return AUTOCORRECT_HINT;
        default: /* other random text */
                break;
        }
@@ -24,7 +24,7 @@ static enum autocorrect_mode parse_autocorrect(const char *value)
        else if (!strcmp(value, "immediate"))
                return AUTOCORRECT_IMMEDIATELY;
        else if (!strcmp(value, "show"))
-               return AUTOCORRECT_SHOW;
+               return AUTOCORRECT_HINT;
        else
                return AUTOCORRECT_DELAY;
 }
@@ -49,7 +49,7 @@ void autocorrect_resolve_config(const char *var, const char *value,
                conf->delay = git_config_int(var, value, ctx->kvi);
 
                if (!conf->delay)
-                       conf->mode = AUTOCORRECT_SHOW;
+                       conf->mode = AUTOCORRECT_HINT;
                else if (conf->delay < 0 || conf->delay == 1)
                        conf->mode = AUTOCORRECT_IMMEDIATELY;
        }
index 5506a36f11a7ccea5f8cf0c615455bf690b1e51d..328807242c15ab76f7faf9e71fd1665b855d7eb8 100644 (file)
@@ -4,7 +4,7 @@
 struct config_context;
 
 enum autocorrect_mode {
-       AUTOCORRECT_SHOW,
+       AUTOCORRECT_HINT,
        AUTOCORRECT_NEVER,
        AUTOCORRECT_PROMPT,
        AUTOCORRECT_IMMEDIATELY,
diff --git a/help.c b/help.c
index a89ac5aced999435712ad1b45b185a950684a0e8..2d441ded3f1489da30124e153074652b7d2c04eb 100644 (file)
--- a/help.c
+++ b/help.c
@@ -674,7 +674,7 @@ char *help_unknown_cmd(const char *cmd)
                        ; /* still counting */
        }
 
-       if (cfg.autocorrect.mode != AUTOCORRECT_SHOW && n == 1 &&
+       if (cfg.autocorrect.mode != AUTOCORRECT_HINT && n == 1 &&
            SIMILAR_ENOUGH(best_similarity)) {
                char *assumed = xstrdup(main_cmds.names[0]->name);