]> git.ipfire.org Git - thirdparty/git.git/commit
parseopt: enable subcommand autocorrection for git-remote and git-notes
authorJiamu Sun <39@barroit.sh>
Thu, 23 Apr 2026 01:37:58 +0000 (10:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Apr 2026 02:02:28 +0000 (11:02 +0900)
commit22188044a9f50a0c5581999b908ff30be393d887
tree4a8b89a02a37210e2155c466f2eb5a3afbc05f3a
parentb9e6a2d30afc65eaf8b5002fa8e098d789291975
parseopt: enable subcommand autocorrection for git-remote and git-notes

Add PARSE_OPT_SUBCOMMAND_AUTOCORRECT to enable autocorrection for
subcommands parsed with PARSE_OPT_SUBCOMMAND_OPTIONAL.

Apply this to git-remote and git-notes, so mistyped subcommands can be
automatically corrected, and builtin entry points no longer need to
handle the unknown subcommand error path themselves.

This is safe. Both builtins either resolve to a single subcommand or
take no subcommand at all, meaning any unknown argument encountered by
the parser must be a mistyped subcommand.

Signed-off-by: Jiamu Sun <39@barroit.sh>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c
builtin/remote.c
parse-options.c
parse-options.h