]> git.ipfire.org Git - thirdparty/git.git/commit - t/t7900-maintenance.sh
builtin/gc.c: let parse-options parse 'git maintenance's subcommands
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 19 Aug 2022 16:04:03 +0000 (18:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2022 18:13:15 +0000 (11:13 -0700)
commit0350954482bca6accd7b4ad072a1bdb83651b376
tree40ee54ca74e8f22dd2a2742819c6e94eae631dfb
parent1c3b05170a02adf894a33bc888b0fb730ee7f236
builtin/gc.c: let parse-options parse 'git maintenance's subcommands

'git maintenanze' parses its subcommands with a couple of if
statements.  parse-options has just learned to parse subcommands, so
let's use that facility instead, with the benefits of shorter code,
handling missing or unknown subcommands, and listing subcommands for
Bash completion.

This change makes 'git maintenance' consistent with other commands in
that the help text shown for '-h' goes to standard output, not error,
in the exit code and error message on unknown subcommand, and the
error message on missing subcommand.  There is a test checking these,
which is now updated accordingly.

Note that some of the functions implementing each subcommand don't
accept any parameters, so add the (unused) 'argc', '**argv' and
'*prefix' parameters to make them match the type expected by
parse-options, and thus avoid casting function pointers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
git.c
t/t7900-maintenance.sh