git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] help.c: configurable suggestions

From
Drew DeVault <sir@cmpwn.com>
Date
Nov 18, 2020, 17:17 UTC
Message-ID
<C76K6Q09ATLR.1OI5KW390LKFX@taiga>
In-Reply-To
<xmqqima237qt.fsf@gitster.c.googlers.com>
On Wed Nov 18, 2020 at 12:16 PM EST, Junio C Hamano wrote:
Show 5 quoted lines
> It is unclear from this description alone why this is needed. The
> seller of this change needs to emphasize how this is better than
> setting the variable to "0" (do not autocorrect). My guess is that
> some users do not even need the suggestion of correct spelling when
> they made a typo?

This is one reason. Another is that spell checking can be computationally expensive, and take an annoyingly long time on low-end devices.

Show 14 quoted lines
> > @@ -706,10 +725,16 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd,
> >  			       const char *error)
> >  {
> >  	int i;
> > -	struct string_list suggested_refs = guess_refs(ref);
> > +	struct string_list suggested_refs;
> >  
> >  	fprintf_ln(stderr, _("%s: %s - %s"), cmd, ref, error);
> >  
> > +	if (autocorrect == AUTOCORRECT_NEVER) {
> > +		exit(1);
> > +	}
>
> I am not sure how the change in this hunk is justifiable.

I think this was caught up in the move from a new config option to changing the meaning of help.autocorrect.

> This is a tangent, but it seems to me that help_unknown_ref() is way
> under-used and lacks usefulness too much---probably these contribute
> to each other.

Given that this is under-utilized anyway, and no longer applicable to the essential purpose of the patch, I'm just going to pull this change out of the patch. If this function starts to enjoy broader usage within git, we could revisit a config lever later on.

Thanks for the feedback, sending v4 shortly.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “help.c: configurable suggestions”
  1. help.c: configurable suggestionsDrew DeVault, Nov 18, 2020
  2. Junio C HamanoNov 18, 2020
  3. Drew DeVaultNov 18, 2020
  4. Junio C HamanoNov 18, 2020
  5. Ævar Arnfjörð BjarmasonNov 18, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.