Re: [PATCH v4 07/10] parseopt: autocorrect mistyped subcommands
- From
- Jiamu Sun <39@barroit.sh>
- Date
- Apr 16, 2026, 02:24 UTC
- Message-ID
- <SY0P300MB080153D97E8B1E90846C8FC3CE232@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
- In-Reply-To
- <xmqqse8w6rd7.fsf@gitster.g>
On Wed, Apr 15, 2026 at 10:55:00AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> 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
Agreed. I will change the subcommand autocorrection behavior to be the same as the main command in the next revision.
Show 7 quoted lines
> 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?").
> Currently, command autocorrection skips all prefix matched commands. In my mind, this shouldn't happen because "branc" can indeed be autocorrected to "branch". I studied the old thread, but didn't find any explanation that expands on why it's doing that. Instead of skipping that, applying the autocorrect handling to that case would be better, maybe? But for this patch, I'll keep them the same.
--
Jiamu Sun <39@barroit.sh>
<sunjiamu@outlook.com>