Re: [PATCH] Add help.autocorrect to enable/disable autocorrecting
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 22, 2008, 23:08 UTC
- Message-ID
- <7vsku1jz4u.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <alpine.DEB.1.00.0807222242160.8986@racer>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 24 quoted lines
> Hi,
>
> On Tue, 22 Jul 2008, Alex Riesen wrote:
>
>> @@ -704,9 +707,10 @@ const char *help_unknown_cmd(const char *cmd)
>>
>> if (!main_cmds.cnt)
>> die ("Uh oh. Your system reports no Git commands at all.");
>> + git_config(git_help_config, NULL);
>> best_similarity = similarity(main_cmds.names[0]->name);
>> - if (main_cmds.cnt < 2 || best_similarity <
>> - similarity(main_cmds.names[1]->name)) {
>> + if (autocorrect && (main_cmds.cnt < 2 ||
>> + best_similarity < similarity(main_cmds.names[1]->name))) {
>> if (!*cwd)
>> exit(1);
>> if (chdir(cwd))
>
> This "if" already checks if there is only one candidate. So you should
> just add an inner "if (autocorrect) ... else single = 1;" or some such.
>
> However, I think that the intention of this patch is too much DWIMery,
> which might be good for me (just like my "git add remote" patch), but not
> for the general audience.Please make autocorrect not a binary but optionally the number of deciseconds before it continues, so that I have a chance to hit ^C ;-)