]> git.99rst.org Git - git.git/commit
ls-tree: slightly refactor `show_tree()`
authorTeng Long <redacted>
Wed, 23 Mar 2022 09:13:09 +0000 (17:13 +0800)
committerJunio C Hamano <redacted>
Wed, 23 Mar 2022 18:38:39 +0000 (11:38 -0700)
commit315f22c853c08b1f3473fc50985d76618f31ebd0
tree8cc67a434fbfc0ac54e46d356a5606c930583c56
parentf6b224d5ebfe9fcf58ef34eddea68d9fb4384d50
ls-tree: slightly refactor `show_tree()`

This is a non-functional change, we introduce an enum "ls_tree_cmdmode"
then use it to mark which columns to output.

This has the advantage of making the show_tree logic simpler and more
readable, as well as making it easier to extend new options (for example,
if we want to add a "--object-only" option, we just need to add a similar
"short-circuit logic in "show_tree()").

Helped-by: Ævar Arnfjörð Bjarmason <redacted>
Signed-off-by: Teng Long <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/ls-tree.c
git clone https://git.99rst.org/PROJECT