6
# So, disable the check until that integration is complete.
7
GIT_TEST_CHECK_CACHE_TREE=0
8
GIT_TEST_SPLIT_INDEX=0
9
+GIT_TEST_SPARSE_INDEX=
10
11
. ./test-lib.sh
12
101
# initialize sparse-checkout definitions
102
git -C sparse-checkout sparse-checkout init --cone &&
103
git -C sparse-checkout sparse-checkout set deep &&
103
- GIT_TEST_SPARSE_INDEX=1 git -C sparse-index sparse-checkout init --cone &&
104
- GIT_TEST_SPARSE_INDEX=1 git -C sparse-index sparse-checkout set deep
104
+ git -C sparse-index sparse-checkout init --cone --sparse-index &&
105
+ test_cmp_config -C sparse-index true index.sparse &&
106
+ git -C sparse-index sparse-checkout set deep
107
}
108
109
run_on_sparse () {
110
(
111
cd sparse-checkout &&
110
- GIT_TEST_SPARSE_INDEX=0 "$@" >../sparse-checkout-out 2>../sparse-checkout-err
112
+ "$@" >../sparse-checkout-out 2>../sparse-checkout-err
113
) &&
114
(
115
cd sparse-index &&
114
- GIT_TEST_SPARSE_INDEX=1 "$@" >../sparse-index-out 2>../sparse-index-err
116
+ "$@" >../sparse-index-out 2>../sparse-index-err
117
)
118
}
119
120
run_on_all () {
121
(
122
cd full-checkout &&
121
- GIT_TEST_SPARSE_INDEX=0 "$@" >../full-checkout-out 2>../full-checkout-err
123
+ "$@" >../full-checkout-out 2>../full-checkout-err
124
) &&
125
run_on_sparse "$@"
126
}
150
|| return 1
151
done &&
152
151
- GIT_TEST_SPARSE_INDEX=1 git -C sparse-index sparse-checkout set folder1 &&
153
+ git -C sparse-index sparse-checkout set folder1 &&
154
155
test-tool -C sparse-index read-cache --table >cache &&
156
for dir in deep folder2 x
160
|| return 1
161
done &&
162
161
- GIT_TEST_SPARSE_INDEX=1 git -C sparse-index sparse-checkout set deep/deeper1 &&
163
+ git -C sparse-index sparse-checkout set deep/deeper1 &&
164
165
test-tool -C sparse-index read-cache --table >cache &&
166
for dir in deep/deeper2 folder1 folder2 x
168
TREE=$(git -C sparse-index rev-parse HEAD:$dir) &&
169
grep "040000 tree $TREE $dir/" cache \
170
|| return 1
169
- done
171
+ done &&
172
+
173
+ # Disabling the sparse-index removes tree entries with full ones
174
+ git -C sparse-index sparse-checkout init --no-sparse-index &&
175
+
176
+ test-tool -C sparse-index read-cache --table >cache &&
177
+ ! grep "040000 tree" cache &&
178
+ test_sparse_match test-tool read-cache --table
179
'
180
181
test_expect_success 'expanded in-memory index matches full index' '
405
test_expect_success 'sparse-index is expanded and converted back' '
406
init_repos &&
407
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
- )
408
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
409
+ git -C sparse-index -c core.fsmonitor="" reset --hard &&
410
+ test_region index convert_to_sparse trace2.txt &&
411
+ test_region index ensure_full_index trace2.txt &&
412
+
413
+ rm trace2.txt &&
414
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
415
+ git -C sparse-index -c core.fsmonitor="" status -uno &&
416
+ test_region index ensure_full_index trace2.txt
417
'
418
419
test_done