Subject: Re: [PATCH v4 07/10] parseopt: autocorrect mistyped subcommands

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Apr 2026 10:55:00 -0700

Jiamu Sun <[email-masked]> writes:

>> I would have expected that we would just emulate what we already do
>> to the main commands, and later with experience with the subcommand
>> typo detection/fixes, would tweak the parameters either only to the
>> subcommand part or to the both with justifications.
> ...
> Because of this, I was confused about whether I should copy this
> behavior. I chose not to.
>
> However, if we want the main commands and subcommands to act the same, I
> can do that and try to move the logic to autocorrect.c so both places
> share the exact same typo detection.
>
> Do you want me to do this?

Either do that (which is probably conceptually simpler), or explain
in the proposed log message why they have to be different.  My gut
feeling is that you should start from identical settings that has
been used for years, and then in a separate topic propose to improve
the parameters to improve the behaviour for both main commands and
sub commands at the same time, but that is largely because there
weren't any explanation why subcommands correction should behave
differently from main commands ("Correction for main commands
behaves strangely and I do not want to inherit it" is not a good
explanation as it invites a natural question "if you have a better
behaviour you can use for subcommand correction, can't it be used
also for main commands?  If not, why not?").