]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1091/t3705: remove 'test-tool read-cache --table'
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 22 Dec 2021 14:20:55 +0000 (14:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Dec 2021 19:42:40 +0000 (11:42 -0800)
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 <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1091-sparse-checkout-builtin.sh
t/t3705-add-sparse-checkout.sh

index 272ba1b566b3eaf43798f9ecfb1a77c26db3f59b..680e0043c36a81aa25c682bb174e77cb1fefa790 100755 (executable)
@@ -212,12 +212,27 @@ test_expect_success 'sparse-index enabled and disabled' '
 
                git -C repo sparse-checkout init --cone --sparse-index &&
                test_cmp_config -C repo true index.sparse &&
-               test-tool -C repo read-cache --table >cache &&
-               grep " tree " cache &&
-
+               git -C repo ls-files --sparse >sparse &&
                git -C repo sparse-checkout disable &&
-               test-tool -C repo read-cache --table >cache &&
-               ! grep " tree " cache &&
+               git -C repo ls-files --sparse >full &&
+
+               cat >expect <<-\EOF &&
+               @@ -1,4 +1,7 @@
+                a
+               -deep/
+               -folder1/
+               -folder2/
+               +deep/a
+               +deep/deeper1/a
+               +deep/deeper1/deepest/a
+               +deep/deeper2/a
+               +folder1/a
+               +folder2/a
+               EOF
+
+               diff -u sparse full | tail -n +3 >actual &&
+               test_cmp expect actual &&
+
                git -C repo config --list >config &&
                ! grep index.sparse config
        )
index f3143c92908d013e4394a76578b1a3fbd5328ab4..81f3384eeed4bba508f2e87aeb72a1a6f9a37394 100755 (executable)
@@ -181,13 +181,13 @@ test_expect_success 'git add fails outside of sparse-checkout definition' '
        # Avoid munging CRLFs to avoid an error message
        git -c core.autocrlf=input add --sparse sparse_entry 2>stderr &&
        test_must_be_empty stderr &&
-       test-tool read-cache --table >actual &&
-       grep "^100644 blob.*sparse_entry\$" actual &&
+       git ls-files --stage >actual &&
+       grep "^100644 .*sparse_entry\$" actual &&
 
        git add --sparse --chmod=+x sparse_entry 2>stderr &&
        test_must_be_empty stderr &&
-       test-tool read-cache --table >actual &&
-       grep "^100755 blob.*sparse_entry\$" actual &&
+       git ls-files --stage >actual &&
+       grep "^100755 .*sparse_entry\$" actual &&
 
        git reset &&