ls-files: add --sparse option
commit78087097b8b77aca355525ebaf98205eb7acad60
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 22 Dec 2021 14:20:53 +0000 (22 14:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Dec 2021 19:42:40 +0000 (22 11:42 -0800)
tree5acd4a9234f38e3859b1dfdf168a9eeb8545d102
parent5a4e0547e2386f9bf0565316d7b751fe9459898b
ls-files: add --sparse option

Existing callers to 'git ls-files' are expecting file names, not
directories. It is best to expand a sparse index to show all of the
contained files in this case.

However, expert users may want to inspect the contents of the index
itself including which directories are sparse. Add a --sparse option to
allow users to request this information.

During testing, I noticed that options such as --modified did not affect
the output when the files in question were outside the sparse-checkout
definition. Tests are added to document this preexisting behavior and
how it remains unchanged with the sparse index and the --sparse option.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-ls-files.txt
builtin/ls-files.c
t/t1092-sparse-checkout-compatibility.sh