]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/show-ref: ensure mutual exclusiveness of subcommands
authorPatrick Steinhardt <ps@pks.im>
Tue, 31 Oct 2023 08:16:46 +0000 (09:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Nov 2023 03:09:00 +0000 (12:09 +0900)
commit199970e72fbfa9c858fdf2eec63bf53704bc01c6
tree2cf402ef6cea5ce0567be82c244d35b479287c0b
parentee26f1e29a7fb2d26946015a7cf946d6d112e432
builtin/show-ref: ensure mutual exclusiveness of subcommands

The git-show-ref(1) command has three different modes, of which one is
implicit and the other two can be chosen explicitly by passing a flag.
But while these modes are standalone and cause us to execute completely
separate code paths, we gladly accept the case where a user asks for
both `--exclude-existing` and `--verify` at the same time even though it
is not obvious what will happen. Spoiler: we ignore `--verify` and
execute the `--exclude-existing` mode.

Let's explicitly detect this invalid usage and die in case both modes
were requested.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/show-ref.c
t/t1403-show-ref.sh