read-tree: integrate with sparse index
commit2c66a7c8cefa27ef56efbc76bdfe13696b9dac3a
authorVictoria Dye <vdye@github.com>
Tue, 1 Mar 2022 20:24:28 +0000 (1 20:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Mar 2022 20:36:01 +0000 (1 12:36 -0800)
tree98b7b1ab12650fda87d8ca3ea89843a45fd516cb
parent14bf38cfcff0b68468444e85bc09c7d5007be34b
read-tree: integrate with sparse index

Enable use of sparse index in 'git read-tree'. The integration in this patch
is limited only to usage of 'read-tree' that does not need additional
functional changes for the sparse index to behave as expected (i.e., produce
the same user-facing results as a non-sparse index sparse-checkout). To
ensure no unexpected behavior occurs, the index is explicitly expanded when:

* '--no-sparse-checkout' is specified (because it disables sparse-checkout)
* '--prefix' is specified (if the prefix is inside a sparse directory, the
  prefixed tree cannot be properly traversed)
* two or more <tree-ish> arguments are specified ('twoway_merge' and
  'threeway_merge' do not yet support merging sparse directories)

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/read-tree.c
t/t1092-sparse-checkout-compatibility.sh