Subject: Re: [PATCH 0/5] parseopt: add subcommand autocorrection

From: Junio C Hamano <[email-masked]>
Date: Sun, 08 Mar 2026 13:11:22 -0700

Jiamu Sun <[email-masked]> writes:

> Git currently provides auto-correction for builtins and aliases, but
> lacks this functionality for subcommands parsed via the parse-options
> API. Subcommands are also commands, and typos will occur, too. Like:
>
> 	git remote add-rul
>
> So, this series introduces subcommand auto-correction.
>
> Currently, builtins with mandatory subcommands enable autocorrection by
> default. However, those using PARSE_OPT_SUBCOMMAND_OPTIONAL skip it to
> avoid treating valid unknown arguments as mistyped subcommands.

This is a bit confusing as it describes the behavior introduced by
this series rather than the state of the codebase before these
patches.  Since subcommand autocorrection doesn't exist yet, it
would be clearer to phrase this as describing your implementation
choices. Perhaps:

    By default, this implementation enables autocorrection for
    builtins with mandatory subcommands. However, for those using
    PARSE_OPT_SUBCOMMAND_OPTIONAL, autocorrection is skipped to
    avoid misinterpreting legitimate unknown arguments as mistyped
    subcommands.

or something, perhaps?