Re: [PATCH v3 5/8] autocorrect: provide config resolution API
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Mar 10, 2026, 14:15 UTC
- Message-ID
- <CAOLa=ZSLRa1Jb4y=eu_jFeTH4id8CG1jjRGV9=1FKYat2JpQng@mail.gmail.com>
- In-Reply-To
- <SY0P300MB08013A8A073C935934E1B4D7CE46A@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
Jiamu Sun <39@barroit.sh> writes:
Show 36 quoted lines
> Add autocorr_resolve(). This resolves and populates the correct values > for autocorrect config. > > Make autocorrect config callback internal. The API is meant to provide > a high-level way to retrieve the config. Allowing access to the config > callback from outside violates that intent. > > Additionally, in some cases, without access to the config callback, two > config iterations cannot be merged into one, which can hurt performance. > This is fine, as the code path that calls autocorr_resolve() is cold. > > Signed-off-by: Jiamu Sun <39@barroit.sh> > --- > autocorrect.c | 15 ++++++++++++--- > autocorrect.h | 5 +---- > help.c | 37 +++++++++++++++---------------------- > 3 files changed, 28 insertions(+), 29 deletions(-) > > diff --git a/autocorrect.c b/autocorrect.c > index 9c4b691fb003..63fa331ef5e2 100644 > --- a/autocorrect.c > +++ b/autocorrect.c > @@ -1,3 +1,5 @@ > +#define USE_THE_REPOSITORY_VARIABLE > + > #include "git-compat-util.h" > #include "autocorrect.h" > #include "config.h" > @@ -29,13 +31,13 @@ static enum autocorr_mode parse_autocorrect(const char *value) > return AUTOCORRECT_DELAY; > } > > -void autocorr_resolve_config(const char *var, const char *value, > - const struct config_context *ctx, void *data) > +static int resolve_autocorr(const char *var, const char *value, > + const struct config_context *ctx, void *data)
So we made this an internal, the return type was changed as `read_early_config()` expects that. Okay
[snip]
The rest of the code makes sense too