Re: [PATCH v3] help: always suggest common-cmds if prefix of cmd
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Dec 1, 2010, 14:33 UTC
- Message-ID
- <AANLkTi=OyK+Qvin9FjrUTyEacxHVLjBG77Qg_PPoC6kK@mail.gmail.com>
- In-Reply-To
- <7vvd3g58ja.fsf@alter.siamese.dyndns.org>
On Mon, Nov 29, 2010 at 6:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> 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?");
>
> Well, the same letter can be an empty string:
>
> $ git ''
>Indeed, my bad.
> Didn't I already suggest BUG() there? Also, saying "too ambiguous" would > make the codepath give "... See 'git --help'" message, I think. >
Sure. I was considering just taking your version verbatim. But let's see what happens, perhaps I get inspired ;)