Skip to content

Commit 61feddc

Browse files
szedergitster
authored andcommitted
tests: disable GIT_TEST_SPLIT_INDEX for sparse index tests
The sparse index and split index features are said to be currently incompatible [1], and consequently GIT_TEST_SPLIT_INDEX=1 might interfere with the test cases exercising the sparse index feature. Therefore GIT_TEST_SPLIT_INDEX is already explicitly disabled for the whole of 't1092-sparse-checkout-compatibility.sh'. There are, however, two other test cases exercising sparse index, namely 'sparse-index enabled and disabled' in 't1091-sparse-checkout-builtin.sh' and 'status succeeds with sparse index' in 't7519-status-fsmonitor.sh', and these two could fail with GIT_TEST_SPLIT_INDEX=1 as well [2]. Unset GIT_TEST_SPLIT_INDEX and disable the split index in these two test cases to avoid such interference. Note that this is the minimal change to merely avoid failures when these test cases are run with GIT_TEST_SPLIT_INDEX=1. Interestingly, though, without these changes the 'git sparse-checkout init --cone --sparse-index' commands still succeed even with split index, and set all the necessary configuration variables and create the initial '$GIT_DIR/info/sparse-checkout' file, but the test failures are caused by later sanity checks finding that the index is not in fact a sparse index. This indicates that 'git sparse-checkout init --sparse-index' lacks some error checking and its tests lack coverage related to split index, but fixing those issues is beyond the scope of this patch series. [1] https://public-inbox.org/git/[email protected]/ [2] Neither of these test cases fail at the moment, because GIT_TEST_SPLIT_INDEX=1 is broken and never splits the index, and it broke long before the sparse index feature was added. This patch series is about to fix GIT_TEST_SPLIT_INDEX, and then both test cases mentioned above would fail. (The diff is best viewed with '--ignore-all-space') Signed-off-by: SZEDER Gábor <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 998330a commit 61feddc

File tree

2 files changed

+51
-42
lines changed

2 files changed

+51
-42
lines changed

t/t1091-sparse-checkout-builtin.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,21 @@ test_expect_success 'sparse-checkout disable' '
206206
'
207207

208208
test_expect_success 'sparse-index enabled and disabled' '
209-
git -C repo sparse-checkout init --cone --sparse-index &&
210-
test_cmp_config -C repo true index.sparse &&
211-
test-tool -C repo read-cache --table >cache &&
212-
grep " tree " cache &&
213-
214-
git -C repo sparse-checkout disable &&
215-
test-tool -C repo read-cache --table >cache &&
216-
! grep " tree " cache &&
217-
git -C repo config --list >config &&
218-
! grep index.sparse config
209+
(
210+
sane_unset GIT_TEST_SPLIT_INDEX &&
211+
git -C repo update-index --no-split-index &&
212+
213+
git -C repo sparse-checkout init --cone --sparse-index &&
214+
test_cmp_config -C repo true index.sparse &&
215+
test-tool -C repo read-cache --table >cache &&
216+
grep " tree " cache &&
217+
218+
git -C repo sparse-checkout disable &&
219+
test-tool -C repo read-cache --table >cache &&
220+
! grep " tree " cache &&
221+
git -C repo config --list >config &&
222+
! grep index.sparse config
223+
)
219224
'
220225

221226
test_expect_success 'cone mode: init and set' '

t/t7519-status-fsmonitor.sh

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -399,41 +399,45 @@ check_sparse_index_behavior () {
399399
}
400400

401401
test_expect_success 'status succeeds with sparse index' '
402-
git clone . full &&
403-
git clone --sparse . sparse &&
404-
git -C sparse sparse-checkout init --cone --sparse-index &&
405-
git -C sparse sparse-checkout set dir1 dir2 &&
402+
(
403+
sane_unset GIT_TEST_SPLIT_INDEX &&
406404
407-
write_script .git/hooks/fsmonitor-test <<-\EOF &&
408-
printf "last_update_token\0"
409-
EOF
410-
git -C full config core.fsmonitor ../.git/hooks/fsmonitor-test &&
411-
git -C sparse config core.fsmonitor ../.git/hooks/fsmonitor-test &&
412-
check_sparse_index_behavior ! &&
405+
git clone . full &&
406+
git clone --sparse . sparse &&
407+
git -C sparse sparse-checkout init --cone --sparse-index &&
408+
git -C sparse sparse-checkout set dir1 dir2 &&
413409
414-
write_script .git/hooks/fsmonitor-test <<-\EOF &&
415-
printf "last_update_token\0"
416-
printf "dir1/modified\0"
417-
EOF
418-
check_sparse_index_behavior ! &&
419-
420-
git -C sparse sparse-checkout add dir1a &&
410+
write_script .git/hooks/fsmonitor-test <<-\EOF &&
411+
printf "last_update_token\0"
412+
EOF
413+
git -C full config core.fsmonitor ../.git/hooks/fsmonitor-test &&
414+
git -C sparse config core.fsmonitor ../.git/hooks/fsmonitor-test &&
415+
check_sparse_index_behavior ! &&
421416
422-
for repo in full sparse
423-
do
424-
cp -r $repo/dir1 $repo/dir1a &&
425-
git -C $repo add dir1a &&
426-
git -C $repo commit -m "add dir1a" || return 1
427-
done &&
428-
git -C sparse sparse-checkout set dir1 dir2 &&
429-
430-
# This one modifies outside the sparse-checkout definition
431-
# and hence we expect to expand the sparse-index.
432-
write_script .git/hooks/fsmonitor-test <<-\EOF &&
433-
printf "last_update_token\0"
434-
printf "dir1a/modified\0"
435-
EOF
436-
check_sparse_index_behavior
417+
write_script .git/hooks/fsmonitor-test <<-\EOF &&
418+
printf "last_update_token\0"
419+
printf "dir1/modified\0"
420+
EOF
421+
check_sparse_index_behavior ! &&
422+
423+
git -C sparse sparse-checkout add dir1a &&
424+
425+
for repo in full sparse
426+
do
427+
cp -r $repo/dir1 $repo/dir1a &&
428+
git -C $repo add dir1a &&
429+
git -C $repo commit -m "add dir1a" || return 1
430+
done &&
431+
git -C sparse sparse-checkout set dir1 dir2 &&
432+
433+
# This one modifies outside the sparse-checkout definition
434+
# and hence we expect to expand the sparse-index.
435+
write_script .git/hooks/fsmonitor-test <<-\EOF &&
436+
printf "last_update_token\0"
437+
printf "dir1a/modified\0"
438+
EOF
439+
check_sparse_index_behavior
440+
)
437441
'
438442

439443
test_done

0 commit comments

Comments
 (0)