From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Jiamu Sun <39@barroit.sh>, git@vger.kernel.org
Subject: Re: [PATCH v3 2/8] help: make autocorrect handling reusable
Date: Tue, 10 Mar 2026 13:10:22 -0700 [thread overview]
Message-ID: <xmqqcy1btpht.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZQypadiSnU1hqHBUzzayGvvvv0z-X+-vNJRFgREmdB+qg@mail.gmail.com> (Karthik Nayak's message of "Tue, 10 Mar 2026 05:52:58 -0700")
Karthik Nayak <karthik.188@gmail.com> 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;
next prev parent reply other threads:[~2026-03-10 20:10 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-08 12:17 [PATCH 0/5] parseopt: add subcommand autocorrection Jiamu Sun
2026-03-08 12:17 ` [PATCH 1/5] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-03-08 23:40 ` Junio C Hamano
2026-03-09 1:56 ` Jiamu Sun
2026-03-08 12:17 ` [PATCH 2/5] help: refactor command autocorrection handling Jiamu Sun
2026-03-08 23:52 ` Junio C Hamano
2026-03-09 2:06 ` Jiamu Sun
2026-03-08 12:17 ` [PATCH 3/5] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-03-09 0:04 ` Junio C Hamano
2026-03-09 2:11 ` Jiamu Sun
2026-03-08 12:17 ` [PATCH 4/5] parseopt: enable subcommand autocorrect for remote and notes Jiamu Sun
2026-03-08 12:17 ` [PATCH 5/5] help: add tests for subcommand autocorrection Jiamu Sun
2026-03-11 17:01 ` Aaron Plattner
2026-03-11 22:45 ` Jiamu Sun
2026-03-12 13:35 ` Junio C Hamano
2026-03-08 20:11 ` [PATCH 0/5] parseopt: add " Junio C Hamano
2026-03-08 22:07 ` Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 " Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 1/5] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 2/5] help: refactor command autocorrection handling Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 3/5] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 4/5] parseopt: enable subcommand autocorrect for remote and notes Jiamu Sun
2026-03-08 23:16 ` [PATCH v2 5/5] help: add tests for subcommand autocorrection Jiamu Sun
2026-03-10 11:40 ` [PATCH v3 0/8] parseopt: add " Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 1/8] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-03-10 12:46 ` Karthik Nayak
2026-03-11 1:49 ` Jiamu Sun
2026-03-11 4:20 ` Junio C Hamano
2026-03-11 4:20 ` Junio C Hamano
2026-03-11 6:12 ` Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 2/8] help: make autocorrect handling reusable Jiamu Sun
2026-03-10 12:52 ` Karthik Nayak
2026-03-10 20:10 ` Junio C Hamano [this message]
2026-03-11 2:05 ` Jiamu Sun
2026-03-11 1:58 ` Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 3/8] help: move tty check for autocorrection to autocorrect.c Jiamu Sun
2026-03-10 14:06 ` Karthik Nayak
2026-03-11 2:16 ` Jiamu Sun
2026-03-12 0:10 ` Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 4/8] autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINTONLY Jiamu Sun
2026-03-10 14:08 ` Karthik Nayak
2026-03-11 2:46 ` Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 5/8] autocorrect: provide config resolution API Jiamu Sun
2026-03-10 14:15 ` Karthik Nayak
2026-03-10 11:41 ` [PATCH v3 6/8] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-03-10 20:16 ` Junio C Hamano
2026-03-11 2:48 ` Jiamu Sun
2026-03-11 23:26 ` Jiamu Sun
2026-03-12 2:38 ` Junio C Hamano
2026-03-12 4:53 ` Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 7/8] parseopt: enable subcommand autocorrection for git-remote and git-notes Jiamu Sun
2026-03-10 11:41 ` [PATCH v3 8/8] help: add tests for subcommand autocorrection Jiamu Sun
2026-03-11 4:23 ` Junio C Hamano
2026-03-11 6:10 ` Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 00/10] parseopt: add " Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 01/10] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 02/10] help: make autocorrect handling reusable Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 03/10] help: move tty check for autocorrection to autocorrect.c Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 04/10] autocorrect: use mode and delay instead of magic numbers Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 05/10] autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINT Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 06/10] autocorrect: provide config resolution API Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 07/10] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-03-16 19:41 ` Junio C Hamano
2026-03-17 3:21 ` Jiamu Sun
2026-04-15 17:55 ` Junio C Hamano
2026-04-16 2:24 ` Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 08/10] parseopt: enable subcommand autocorrection for git-remote and git-notes Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 09/10] parseopt: add tests for subcommand autocorrection Jiamu Sun
2026-03-16 15:36 ` [PATCH v4 10/10] doc: document autocorrect API Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 00/10] parseopt: add subcommand autocorrection Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 01/10] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 02/10] help: make autocorrect handling reusable Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 03/10] help: move tty check for autocorrection to autocorrect.c Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 04/10] autocorrect: use mode and delay instead of magic numbers Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 05/10] autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINT Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 06/10] autocorrect: provide config resolution API Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 07/10] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 08/10] parseopt: enable subcommand autocorrection for git-remote and git-notes Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 09/10] parseopt: add tests for subcommand autocorrection Jiamu Sun
2026-04-22 12:18 ` [PATCH v5 10/10] doc: document autocorrect API Jiamu Sun
2026-04-23 0:08 ` [PATCH v5 00/10] parseopt: add subcommand autocorrection Junio C Hamano
2026-04-23 1:14 ` Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 " Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 01/10] parseopt: extract subcommand handling from parse_options_step() Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 02/10] help: make autocorrect handling reusable Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 03/10] help: move tty check for autocorrection to autocorrect.c Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 04/10] autocorrect: use mode and delay instead of magic numbers Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 05/10] autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINT Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 06/10] autocorrect: provide config resolution API Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 07/10] parseopt: autocorrect mistyped subcommands Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 08/10] parseopt: enable subcommand autocorrection for git-remote and git-notes Jiamu Sun
2026-04-23 1:37 ` [PATCH v6 09/10] parseopt: add tests for subcommand autocorrection Jiamu Sun
2026-04-23 1:38 ` [PATCH v6 10/10] doc: document autocorrect API Jiamu Sun
2026-05-11 3:03 ` [PATCH v6 00/10] parseopt: add subcommand autocorrection Junio C Hamano
2026-05-15 14:34 ` Jiamu Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqcy1btpht.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=39@barroit.sh \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.