merge-ort: expand only for out-of-cone conflicts
commit695763679210420656f4125d9706bba25c76ae4b
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 8 Sep 2021 11:23:58 +0000 (8 11:23 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Sep 2021 22:49:04 +0000 (9 15:49 -0700)
tree3c482768cde72529b4a6bb0f883a7e0f5c7f53af
parenta33806398a418289388ad992e385a314b4b10225
merge-ort: expand only for out-of-cone conflicts

Merge conflicts happen often enough to want to avoid expanding a sparse
index when they happen, as long as those conflicts are within the
sparse-checkout cone. If a conflict exists outside of the
sparse-checkout cone, then we still need to expand before iterating over
the index entries. This is critical to do in advance because of how the
original_cache_nr is tracked to allow inserting and replacing cache
entries.

Iterate over the conflicted files and check if any paths are outside of
the sparse-checkout cone. If so, then expand the full index.

Add a test that demonstrates that we do not expand the index, even when
we hit a conflict within the sparse-checkout cone.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c
t/t1092-sparse-checkout-compatibility.sh