Skip to content

Commit c2a2940

Browse files
derrickstoleegitster
authored andcommitted
t1091/t3705: remove 'test-tool read-cache --table'
Now that 'git ls-files --sparse' exists, we can use it to verify the state of a sparse index instead of 'test-tool read-cache table'. Replace these usages within t1091-sparse-checkout-builtin.sh and t3705-add-sparse-checkout.sh. The important changes are due to the different output format. In t3705, we need to use the '--stage' output to get a file mode and OID, but it also includes a stage value and drops the object type. This leads to some differences in how we handle looking for specific entries. In t1091, the test focuses on enabling the sparse index, so we do not need the --stage flag to demonstrate how the index changes, and instead can use a diff. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a9a6ac commit c2a2940

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

t/t1091-sparse-checkout-builtin.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,27 @@ test_expect_success 'sparse-index enabled and disabled' '
212212
213213
git -C repo sparse-checkout init --cone --sparse-index &&
214214
test_cmp_config -C repo true index.sparse &&
215-
test-tool -C repo read-cache --table >cache &&
216-
grep " tree " cache &&
217-
215+
git -C repo ls-files --sparse >sparse &&
218216
git -C repo sparse-checkout disable &&
219-
test-tool -C repo read-cache --table >cache &&
220-
! grep " tree " cache &&
217+
git -C repo ls-files --sparse >full &&
218+
219+
cat >expect <<-\EOF &&
220+
@@ -1,4 +1,7 @@
221+
a
222+
-deep/
223+
-folder1/
224+
-folder2/
225+
+deep/a
226+
+deep/deeper1/a
227+
+deep/deeper1/deepest/a
228+
+deep/deeper2/a
229+
+folder1/a
230+
+folder2/a
231+
EOF
232+
233+
diff -u sparse full | tail -n +3 >actual &&
234+
test_cmp expect actual &&
235+
221236
git -C repo config --list >config &&
222237
! grep index.sparse config
223238
)

t/t3705-add-sparse-checkout.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ test_expect_success 'git add fails outside of sparse-checkout definition' '
181181
# Avoid munging CRLFs to avoid an error message
182182
git -c core.autocrlf=input add --sparse sparse_entry 2>stderr &&
183183
test_must_be_empty stderr &&
184-
test-tool read-cache --table >actual &&
185-
grep "^100644 blob.*sparse_entry\$" actual &&
184+
git ls-files --stage >actual &&
185+
grep "^100644 .*sparse_entry\$" actual &&
186186
187187
git add --sparse --chmod=+x sparse_entry 2>stderr &&
188188
test_must_be_empty stderr &&
189-
test-tool read-cache --table >actual &&
190-
grep "^100755 blob.*sparse_entry\$" actual &&
189+
git ls-files --stage >actual &&
190+
grep "^100755 .*sparse_entry\$" actual &&
191191
192192
git reset &&
193193

0 commit comments

Comments
 (0)