commit-graph: show usage on "commit-graph [write|verify] garbage"
commit6d209a01f89fd27d42e0a74a5ada29cef1dcac29
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 23 Aug 2021 12:30:20 +0000 (23 14:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2021 00:06:18 +0000 (30 17:06 -0700)
tree65607f1d7506502d19a4d3d6e9e6ff3d319cd76d
parent070e7c5619bfaca2b1e93255d892b68ed455aaa6
commit-graph: show usage on "commit-graph [write|verify] garbage"

Change the parse_options() invocation in the commit-graph code to
error on unknown leftover argv elements, in addition to the existing
and implicit erroring via parse_options() on unknown options.

We'd already error in cmd_commit_graph() on e.g.:

    git commit-graph unknown verify
    git commit-graph --unknown verify

But here we're calling parse_options() twice more for the "write" and
"verify" subcommands. We did not do the same checking for leftover
argv elements there. As a result we'd silently accept garbage in these
subcommands, let's not do that.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit-graph.c
t/t5318-commit-graph.sh