t1092: add sparse directory before cone in test repo

Add a sparse directory 'before/' containing files 'a' and 'b' to the test repo used in 't/t1092-sparse-checkout-compatibility.sh'. This is meant to ensure that no sparse index integrations rely on the in-cone path(s) being lexicographically first in the repo. Unfortunately, some existing tests do not handle this repo architecture properly: * 'add outside sparse cone' * 'status/add: outside sparse cone' * 'reset with pathspecs inside sparse definition' All three of these are due to the incorrect handling of the 'unpack_trees_options.cache_bottom' when performing a cache diff via 'unpack_trees'. This will be corrected in a future patch; in the meantime, mark the tests with 'test_expect_failure'. Finally, update the 'ls-files' and 'root directory cannot be sparse' tests to include the 'before/' directory in their expected index contents. Co-authored-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Victoria Dye committed Mar 17, 2022 at 15:55 UTC c3a9cecc7f5ea8b36d6943b868122ca0bfbc0f9c
1 file changed +9 -4
t/t1092-sparse-checkout-compatibility.sh
+9 -4
@@ -16,7 +16,9 @@ test_expect_success 'setup' '
16 echo "after deep" >e &&
17 echo "after folder1" >g &&
18 echo "after x" >z &&
19 - mkdir folder1 folder2 deep x &&
19 + mkdir folder1 folder2 deep before x &&
20 + echo "before deep" >before/a &&
21 + echo "before deep again" >before/b &&
22 mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
23 mkdir deep/deeper1/deepest &&
24 mkdir deep/deeper1/deepest2 &&
@@ -254,6 +256,7 @@ test_expect_success 'root directory cannot be sparse' '
256
257 # Verify sparse directories still present, root directory is not sparse
258 cat >expect <<-EOF &&
259 + before/
260 folder1/
261 folder2/
262 x/
@@ -337,7 +340,7 @@ test_expect_success 'deep changes during checkout' '
340 test_all_match git checkout base
341 '
342
340 -test_expect_success 'add outside sparse cone' '
343 +test_expect_failure 'add outside sparse cone' '
344 init_repos &&
345
346 run_on_sparse mkdir folder1 &&
@@ -379,7 +382,7 @@ test_expect_success 'commit including unstaged changes' '
382 test_all_match git status --porcelain=v2
383 '
384
382 -test_expect_success 'status/add: outside sparse cone' '
385 +test_expect_failure 'status/add: outside sparse cone' '
386 init_repos &&
387
388 # folder1 is at HEAD, but outside the sparse cone
@@ -590,7 +593,7 @@ test_expect_success 'checkout and reset (keep)' '
593 test_all_match test_must_fail git reset --keep deepest
594 '
595
593 -test_expect_success 'reset with pathspecs inside sparse definition' '
596 +test_expect_failure 'reset with pathspecs inside sparse definition' '
597 init_repos &&
598
599 write_script edit-contents <<-\EOF &&
@@ -1444,6 +1447,7 @@ test_expect_success 'ls-files' '
1447
1448 cat >expect <<-\EOF &&
1449 a
1450 + before/
1451 deep/
1452 e
1453 folder1-
@@ -1491,6 +1495,7 @@ test_expect_success 'ls-files' '
1495
1496 cat >expect <<-\EOF &&
1497 a
1498 + before/
1499 deep/
1500 e
1501 folder1-