]> git.ipfire.org Git - thirdparty/git.git/commit
cat-file: fix remaining usage bugs
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 28 Dec 2021 13:28:47 +0000 (14:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Dec 2021 21:05:29 +0000 (13:05 -0800)
commitb3fe468075b7f0aa40f7a22a5a50e5e3e5fb2148
treedbecf0696bb0f308c6c9c1acfd653f41d22918c3
parent485fd2c3dae9c05b43fe237f402274a59eb68e81
cat-file: fix remaining usage bugs

With the migration of --batch-all-objects to OPT_CMDMODE() in the
preceding commit one bug with combining it and other OPT_CMDMODE()
options was solved, but we were still left with e.g. --buffer silently
being discarded when not in batch mode.

Fix all those bugs, and in addition emit errors telling the user
specifically what options can't be combined with what other options,
before this we'd usually just emit the cryptic usage text and leave
the users to work it out by themselves.

This change is rather large, because to do so we need to untangle the
options processing so that we can not only error out, but emit
sensible errors, and e.g. emit errors about options before errors
about stray argc elements (as they might become valid if the option
were removed).

Some of the output changes ("error:" to "fatal:" with
usage_msg_opt[f]()), but none of the exit codes change, except in
those cases where we silently accepted bad option combinations before,
now we'll error out.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
t/t1006-cat-file.sh