Skip to content

Commit 0938e6f

Browse files
derrickstoleegitster
authored andcommitted
sparse-index: check index conversion happens
Add a test case that uses test_region to ensure that we are truly expanding a sparse index to a full one, then converting back to sparse when writing the index. As we integrate more Git commands with the sparse index, we will convert these commands to check that we do _not_ convert the sparse index to a full index and instead stay sparse the entire time. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 13e1331 commit 0938e6f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,22 @@ test_expect_success 'submodule handling' '
393393
grep "160000 commit $(git -C initial-repo rev-parse HEAD) modules/sub" cache
394394
'
395395

396+
test_expect_success 'sparse-index is expanded and converted back' '
397+
init_repos &&
398+
399+
(
400+
GIT_TEST_SPARSE_INDEX=1 &&
401+
export GIT_TEST_SPARSE_INDEX &&
402+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
403+
git -C sparse-index -c core.fsmonitor="" reset --hard &&
404+
test_region index convert_to_sparse trace2.txt &&
405+
test_region index ensure_full_index trace2.txt &&
406+
407+
rm trace2.txt &&
408+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
409+
git -C sparse-index -c core.fsmonitor="" status -uno &&
410+
test_region index ensure_full_index trace2.txt
411+
)
412+
'
413+
396414
test_done

0 commit comments

Comments
 (0)