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

Re: [PATCH 4/4] allow recovery from command name typos

From
Thomas Rast <trast@student.ethz.ch>
Date
May 7, 2012, 09:43 UTC
Message-ID
<878vh4con4.fsf@thomas.inf.ethz.ch>
In-Reply-To
<CALUzUxqXrsB8XfQL6vOiQo1pLHNRjxRUxJLRiK_mcSU8fvTSCg@mail.gmail.com>
Tay Ray Chuan <rctay89@gmail.com> writes:
Show 21 quoted lines
> On Sun, May 6, 2012 at 4:21 PM, Jeff King <peff@peff.net> wrote:
>> On Sun, May 06, 2012 at 02:55:30PM +0800, Tay Ray Chuan wrote:
>>
>>>   $ git sh --pretty=oneline
>>>   git: 'sh' is not a git command. See 'git --help'.
>>>
>>>   Did you mean one of these?
>>>   1:  show
>>>   2:  push
>>>   [1/2/.../n] 1
>>
>> Ugh. Please protect this with a config variable that defaults to
>> "off".  It is very un-Unix to prompt unexpectedly, and I suspect a lot
>> of people would be annoyed by this behavior changing by default (I know
>> I would be).
>>
>> -Peff
>
> While I agree there should be a config to protect this, I was hoping
> this would be useful to users on the terminal who make the occasional
> slip-up, without having to do any prior configuration.
We already have help.autocorrect.  It defaults to 0, which results in
  $ g rebest
  git: 'rebest' is not a git command. See 'git --help'.
  
  Did you mean one of these?
          rebase
          reset
          revert

But it can also be a timeout in deciseconds, after which the match is automatically executed (if there is only one). You could hijack it by

* making 'ask' mean your new feature
* making 'off' etc. be the same as 0 for sanity
* making the default value be like 0, but with an extra message such as
    Use 'git config --global help.autocorrect ask' to let me prompt for
    the correct command.
  though I'm sure you can improve on the wording.
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Tay Ray ChuanNext: Tay Ray Chuan
Message 8 of 37 in “allow recovery from command name typos”
  1. 0/4 allow recovery from command name typosTay Ray Chuan, May 6, 2012
  2. 1/4 help.c::uniq: plug a leakTay Ray Chuan, May 6, 2012
  3. 2/4 help.c::exclude_cmds: plug a leakTay Ray Chuan, May 6, 2012
  4. 3/4 help.c: plug a leak when help.autocorrect is setTay Ray Chuan, May 6, 2012
  5. 4/4 allow recovery from command name typosTay Ray Chuan, May 6, 2012
  6. Jeff KingMay 6, 2012
  7. Tay Ray ChuanMay 6, 2012
  8. Thomas RastMay 7, 2012
  9. Tay Ray ChuanMay 7, 2012
  10. Junio C HamanoMay 7, 2012
  11. Tay Ray ChuanMay 9, 2012
  12. Junio C HamanoMay 9, 2012
  13. Jeff KingMay 6, 2012
  14. Tay Ray ChuanMay 6, 2012
  15. Jeff KingMay 7, 2012
  16. 0/4 allow recovery from command name typosTay Ray Chuan, Jul 25, 2012
  17. 1/4 help.c::uniq: plug a leakTay Ray Chuan, Jul 25, 2012
  18. 2/4 help.c::exclude_cmds: realloc() before copy, plug a leakTay Ray Chuan, Jul 25, 2012
  19. 3/4 help.c: plug leaks with(out) help.autocorrectTay Ray Chuan, Jul 25, 2012
  20. 4/4 allow recovery from command name typosTay Ray Chuan, Jul 25, 2012
  21. Junio C HamanoJul 25, 2012
  22. Tay Ray ChuanJul 26, 2012
  23. Jeff KingJul 26, 2012
  24. Junio C HamanoJul 26, 2012
  25. Jeff KingJul 26, 2012
  26. Junio C HamanoJul 26, 2012
  27. Junio C HamanoJul 25, 2012
  28. Junio C HamanoJul 25, 2012
  29. 0/2 allow recovery from command name typosTay Ray Chuan, Aug 5, 2012
  30. 1/2 add interface for /dev/tty interactionTay Ray Chuan, Aug 5, 2012
  31. 2/2 allow recovery from command name typosTay Ray Chuan, Aug 5, 2012
  32. Junio C HamanoAug 6, 2012
  33. Junio C HamanoAug 5, 2012
  34. Jeff KingAug 6, 2012
  35. Jeff KingAug 6, 2012
  36. Junio C HamanoAug 6, 2012
  37. Tay Ray ChuanMay 6, 2012

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.