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

Re: [PATCH v3] help: always suggest common-cmds if prefix of cmd

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Nov 29, 2010, 16:53 UTC
Message-ID
<AANLkTim_TiC-CSGz6x4cH44meJ6SpQv0sg3-rVWsDcKK@mail.gmail.com>
In-Reply-To
<20101129164049.GH8037@burratino>
On Mon, Nov 29, 2010 at 5:40 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 20 quoted lines
> Erik Faye-Lund wrote:
>
>> For this code-path to trigger we would have to be able to prefix-match
>> every common command AND every "main command" must be included in
>> common commands. At the same time. The only possible way to
>> prefix-match all commands is if they all start with the same letter.
>> Do you really think this is a situation we could ever end up in? Every
>> git command being a common-command, starting with the same letter?
>>
>> This is basically unreachable code. Perhaps it'd be even clearer just to die:
>>
>> if (main_cmds.cnt <= n)
>>       die("Prefix-matched everyting, what's going on?");
>
> (I haven't checked.)  Maybe
>
>        $ git ""
>
> ?
>

Ah, yes. This does indeed work, both on Linux and Windows, and it does weaken my point about the unlikeliness of the code ever reaching it.

But I must say that I think the most sane thing to do in this case would be to just display the normal help-page (like "git" does).

Previous: Jonathan NiederNext: Junio C Hamano
Message 23 of 27 in “bug: unexpected output for "git st" + suggestion”
  1. Tarek ZiadéNov 23, 2010
  2. Nguyen Thai Ngoc DuyNov 23, 2010
  3. Tarek ZiadéNov 23, 2010
  4. Nguyen Thai Ngoc DuyNov 23, 2010
  5. Tarek ZiadéNov 23, 2010
  6. Nguyen Thai Ngoc DuyNov 23, 2010
  7. Andreas SchwabNov 23, 2010
  8. Sylvain RabotNov 23, 2010
  9. Erik Faye-LundNov 23, 2010
  10. Tarek ZiadéNov 23, 2010
  11. Erik Faye-LundNov 23, 2010
  12. Tarek ZiadéNov 23, 2010
  13. help: always suggest common-cmds if prefix of cmdErik Faye-Lund, Nov 23, 2010
  14. Junio C HamanoNov 24, 2010
  15. Erik Faye-LundNov 24, 2010
  16. help: always suggest common-cmds if prefix of cmdErik Faye-Lund, Nov 24, 2010
  17. Junio C HamanoNov 25, 2010
  18. Erik Faye-LundNov 25, 2010
  19. help: always suggest common-cmds if prefix of cmdErik Faye-Lund, Nov 26, 2010
  20. Junio C HamanoNov 27, 2010
  21. Erik Faye-LundNov 29, 2010
  22. Jonathan NiederNov 29, 2010
  23. Erik Faye-LundNov 29, 2010
  24. Junio C HamanoNov 29, 2010
  25. Erik Faye-LundDec 1, 2010
  26. help.autoCorrect prefix selection considered a bit dangerousÆvar Arnfjörð Bjarmason, Nov 19, 2018
  27. Junio C HamanoNov 20, 2018

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.