ls-tree: fix "--name-only" and "--long" combined use bug
commitf6b224d5ebfe9fcf58ef34eddea68d9fb4384d50
authorTeng Long <dyroneteng@gmail.com>
Wed, 23 Mar 2022 09:13:08 +0000 (23 17:13 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Mar 2022 18:38:39 +0000 (23 11:38 -0700)
tree8752ec76332ca8ff55234d24cfa6fe7ba1dc9c63
parent87af0ddf5f311e9b6e361daaa7fd591a230261a0
ls-tree: fix "--name-only" and "--long" combined use bug

If we execute "git ls-tree" with combined "--name-only" and "--long"
, only the pathname will be printed, the size is omitted (the original
discoverer was Peff in [1]).

This commit fix this issue by using `OPT_CMDMODE()` instead to make both
of them mutually exclusive.

[1] https://public-inbox.org/git/YZK0MKCYAJmG+pSU@coredump.intra.peff.net/

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-tree.c
t/t3103-ls-tree-misc.sh