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).