Subject: Re: [PATCH v3 2/8] help: make autocorrect handling reusable

From: Junio C Hamano <[email-masked]>
Date: Tue, 10 Mar 2026 13:10:22 -0700

Karthik Nayak <[email-masked]> writes:

>> +#define AUTOCORRECT_SHOW (-4)
>> +#define AUTOCORRECT_PROMPT (-3)
>> +#define AUTOCORRECT_NEVER (-2)
>> +#define AUTOCORRECT_IMMEDIATELY (-1)
>> +
>> +struct config_context;
>> +
>> +void autocorr_resolve_config(const char *var, const char *value,
>> +			     const struct config_context *ctx, void *data);
>> +
>> +void autocorr_confirm(int autocorr, const char *assumed);
>> +
>
> Why not use s/autocorr/autocorrect/ ? Also would be nice to add some
> documentation about each of the functions here.

Good.

>
> [snip]
>
> Also got this from running `git-clang-format` on this commit. Generally
> applying changes while moving code makes it harder to review. But here
> the changes are small enough that we could get away with it. I'll leave
> it to you.

No, you cannot leave it to the author.  

Leave it to CodingGuidelines; case and switch would start at the
same column.

> diff --git a/autocorrect.c b/autocorrect.c
> index 1037f03201..87351fd08f 100644
> --- a/autocorrect.c
> +++ b/autocorrect.c
> @@ -9,12 +9,12 @@
>  static int parse_autocorrect(const char *value)
>  {
>  	switch (git_parse_maybe_bool_text(value)) {
> -		case 1:
> -			return AUTOCORRECT_IMMEDIATELY;
> -		case 0:
> -			return AUTOCORRECT_SHOW;
> -		default: /* other random text */
> -			break;
> +	case 1:
> +		return AUTOCORRECT_IMMEDIATELY;
> +	case 0:
> +		return AUTOCORRECT_SHOW;
> +	default: /* other random text */
> +		break;
>  	}
>
>  	if (!strcmp(value, "prompt"))
> diff --git a/autocorrect.h b/autocorrect.h
> index 45609990c7..38f1e73131 100644
> --- a/autocorrect.h
> +++ b/autocorrect.h
> @@ -1,9 +1,9 @@
>  #ifndef AUTOCORRECT_H
>  #define AUTOCORRECT_H
>
> -#define AUTOCORRECT_SHOW (-4)
> -#define AUTOCORRECT_PROMPT (-3)
> -#define AUTOCORRECT_NEVER (-2)
> +#define AUTOCORRECT_SHOW	(-4)
> +#define AUTOCORRECT_PROMPT	(-3)
> +#define AUTOCORRECT_NEVER	(-2)
>  #define AUTOCORRECT_IMMEDIATELY (-1)
>
>  struct config_context;