summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-03-30 15:10:58 +0200
committerJunio C Hamano <gitster@pobox.com>2021-03-30 21:57:47 +0200
commit0938e6ff552510d4e6e495f062a9fab3e932178a (patch)
tree9590806c84393d8f0a379d523623a33be35c8e67 /t
parentunpack-trees: allow sparse directories (diff)
downloadgit-0938e6ff552510d4e6e495f062a9fab3e932178a.tar.xz
git-0938e6ff552510d4e6e495f062a9fab3e932178a.zip
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 <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index cba5f89b1e..47f9832178 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -393,4 +393,22 @@ test_expect_success 'submodule handling' '
grep "160000 commit $(git -C initial-repo rev-parse HEAD) modules/sub" cache
'
+test_expect_success 'sparse-index is expanded and converted back' '
+ init_repos &&
+
+ (
+ GIT_TEST_SPARSE_INDEX=1 &&
+ export GIT_TEST_SPARSE_INDEX &&
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
+ git -C sparse-index -c core.fsmonitor="" reset --hard &&
+ test_region index convert_to_sparse trace2.txt &&
+ test_region index ensure_full_index trace2.txt &&
+
+ rm trace2.txt &&
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
+ git -C sparse-index -c core.fsmonitor="" status -uno &&
+ test_region index ensure_full_index trace2.txt
+ )
+'
+
test_done