]> git.ipfire.org Git - thirdparty/git.git/commit
parse-options: add a separate case for help output on error
authorbrian m. carlson <sandals@crustytoothpaste.net>
Wed, 8 Jul 2026 00:15:55 +0000 (00:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Jul 2026 00:48:56 +0000 (17:48 -0700)
commit154aee0bd2d7feba0de20ab6ffbeac081fe6051a
tree7468ea2c1dcde49160a61c2fb2004a8ea646bd4c
parent5df632cd0574bfb6b936cd3330eabd237201c387
parse-options: add a separate case for help output on error

When we parse a command line option such as -h or --help, we currently
exit 129, since that is the exit code when help output is printed. In a
future commit, we'll change this to exit 0 instead, since we're doing
what the user wanted successfully.

However, there are some cases where we print help output because the
user has provided ambiguous or invalid input, such as an ambiguous
option, and we'll want to exit unsuccessfully there.  Make this easier
by defining a new return code, PARSE_OPT_HELP_ERROR, that can be used in
this case, while reserving PARSE_OPT_HELP for those cases where the user
has requested help directly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c
builtin/shortlog.c
builtin/update-index.c
parse-options.c
parse-options.h