ls-tree: use a "struct options"
commit030a3d5d9e49a392b347d3d857c60fc811f6fcb9
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 12 Jan 2023 09:11:31 +0000 (12 17:11 +0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jan 2023 23:09:22 +0000 (13 15:09 -0800)
tree0dcfd3babd8d0bf8ca5ba27e6c248da1c4a0e102
parent7677417b5762df860ca454e83dc41dd9df5a9d1c
ls-tree: use a "struct options"

As a first step towards being able to turn this code into an API some
day let's change the "static" options in builtin/ls-tree.c into a
"struct ls_tree_options" that can be constructed dynamically without
the help of parse_options().

Because we're now using non-static variables for this we'll need to
clear_pathspec() at the end of cmd_ls_tree(), least various tests
start failing under SANITIZE=leak. The memory leak was already there
before, now it's just being brought to the surface.

Signed-off-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