]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5318-commit-graph.sh
builtin/commit-graph.c: let parse-options parse subcommands
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 19 Aug 2022 16:04:02 +0000 (18:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2022 18:13:15 +0000 (11:13 -0700)
commit1c3b05170a02adf894a33bc888b0fb730ee7f236
tree83350f2dde279f775d588825c36e9b3e584a9a2c
parentaef7d75e5809eda765bbe407c7f8e0f8617f0fd0
builtin/commit-graph.c: let parse-options parse subcommands

'git commit-graph' parses its subcommands with an if-else if
statement.  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.

Note that the functions implementing each subcommand only accept the
'argc' and '**argv' parameters, so add a (unused) '*prefix' parameter
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/commit-graph.c
t/t5318-commit-graph.sh