Re: [PATCH v4 07/10] parseopt: autocorrect mistyped subcommands
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 15, 2026, 17:55 UTC
- Message-ID
- <xmqqse8w6rd7.fsf@gitster.g>
- In-Reply-To
- <ME0P300MB08117F31CDFE8D038C3E0557CE41A@ME0P300MB0811.AUSP300.PROD.OUTLOOK.COM>
Jiamu Sun <39@barroit.sh> writes:
Show 13 quoted lines
>> 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?").