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

Re: [PATCH] help: interpret help.autocorrect=1 as "immediate" rather than 0.1s

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 9, 2025, 01:12 UTC
Message-ID
<xmqq34hsn62t.fsf@gitster.g>
In-Reply-To
<pull.1869.git.git.1736364707068.gitgitgadget@gmail.com>
"Scott Chacon via GitGitGadget" <gitgitgadget@gmail.com> writes:
> This patch simply interprets a "1" value as the same as the "immedate"
> autocorrect setting, which makes it skip the 0.1s and simply say that it's
> running the command, which is almost certainly what everyone setting it to
> that value is actually trying to do.

It is a cute hack, but special casing a string that is a single letter "1" in a value that can take a number smells somewhat bad to me X-<. If we were redoing this from the start, we would probably pick a better name for the variable (with "delay" somewhere in the name), but that is water under the bridge.

I however wonder if we should allow people to have their cake and eat it too. It currently says it is *not* a boolean, and manually interpret "never" and other things, ...

		if (!value)
Show 8 quoted lines
>  			return config_error_nonbool(var);
>  		if (!strcmp(value, "never")) {
>  			cfg->autocorrect = AUTOCORRECT_NEVER;
> -		} else if (!strcmp(value, "immediate")) {
> +		} else if (!strcmp(value, "immediate") || !strcmp(value, "1")) {
>  			cfg->autocorrect = AUTOCORRECT_IMMEDIATELY;
>  		} else if (!strcmp(value, "prompt")) {
>  			cfg->autocorrect = AUTOCORRECT_PROMPT;
... but would it be simpler if we made it an extended boolean, i.e.
    true, yes, on, 1  -> same as "immediate"
    false, no, off, 0 -> same as "never"
    immediate         -> same as what we currently do
    never             -> same as what we currently do
    prompt            -> same as what we currently do
    number            -> same as what we currently do

It would kill many birds with a stone (e.g., help.autocorrect=no does not work in the current system as anybody would expect, but it would with the "this is an extended boolean" approach).

I dunno.
Thanks.
Previous: Taylor BlauNext: Yongmin
Message 5 of 24 in “help: interpret help.autocorrect=1 as "immediate" rather than 0.1s”
  1. help: interpret help.autocorrect=1 as "immediate" rather than 0.1sScott Chacon via GitGitGadget, Jan 8, 2025
  2. Kristoffer HaugsbakkJan 8, 2025
  3. Johannes SchindelinJan 9, 2025
  4. Taylor BlauJan 13, 2025
  5. Junio C HamanoJan 9, 2025
  6. YongminJan 9, 2025
  7. help: interpret boolean string values for help.autocorrectScott Chacon via GitGitGadget, Jan 9, 2025
  8. Junio C HamanoJan 9, 2025
  9. Scott ChaconJan 10, 2025
  10. Scott ChaconJan 10, 2025
  11. Jeff KingJan 10, 2025
  12. Junio C HamanoJan 10, 2025
  13. help: interpret boolean string values for help.autocorrectScott Chacon via GitGitGadget, Jan 11, 2025
  14. Jeff KingJan 13, 2025
  15. Scott ChaconJan 13, 2025
  16. Junio C HamanoJan 13, 2025
  17. Junio C HamanoJan 18, 2025
  18. help: interpret boolean string values for help.autocorrectScott Chacon via GitGitGadget, Jan 13, 2025
  19. 1/2 help: show the suggested command when help.autocorrect is falseDavid Aguilar, Feb 1, 2025
  20. 2/2 help: add "show" as a valid configuration valueDavid Aguilar, Feb 1, 2025
  21. Junio C HamanoFeb 3, 2025
  22. Junio C HamanoFeb 3, 2025
  23. Jeff KingFeb 4, 2025
  24. Junio C HamanoFeb 4, 2025

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.