git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/3] t1092: add sparse directory before cone in test repo

From
Victoria Dye via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 17, 2022, 15:55 UTC
Message-ID
<d1491d299a94a7f776b2e20b4ff586f544487443.1647532536.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1179.v2.git.1647532536.gitgitgadget@gmail.com>
From: Victoria Dye <vdye@github.com>

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>
---
 t/t1092-sparse-checkout-compatibility.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index dcc0a30d4ad..dcd7061fb3b 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -16,7 +16,9 @@ test_expect_success 'setup' '
 		echo "after deep" >e &&
 		echo "after folder1" >g &&
 		echo "after x" >z &&
-		mkdir folder1 folder2 deep x &&
+		mkdir folder1 folder2 deep before x &&
+		echo "before deep" >before/a &&
+		echo "before deep again" >before/b &&
 		mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
 		mkdir deep/deeper1/deepest &&
 		mkdir deep/deeper1/deepest2 &&
@@ -254,6 +256,7 @@ test_expect_success 'root directory cannot be sparse' '
 
 	# Verify sparse directories still present, root directory is not sparse
 	cat >expect <<-EOF &&
+	before/
 	folder1/
 	folder2/
 	x/
@@ -337,7 +340,7 @@ test_expect_success 'deep changes during checkout' '
 	test_all_match git checkout base
 '
 
-test_expect_success 'add outside sparse cone' '
+test_expect_failure 'add outside sparse cone' '
 	init_repos &&
 
 	run_on_sparse mkdir folder1 &&
@@ -379,7 +382,7 @@ test_expect_success 'commit including unstaged changes' '
 	test_all_match git status --porcelain=v2
 '
 
-test_expect_success 'status/add: outside sparse cone' '
+test_expect_failure 'status/add: outside sparse cone' '
 	init_repos &&
 
 	# folder1 is at HEAD, but outside the sparse cone
@@ -590,7 +593,7 @@ test_expect_success 'checkout and reset (keep)' '
 	test_all_match test_must_fail git reset --keep deepest
 '
 
-test_expect_success 'reset with pathspecs inside sparse definition' '
+test_expect_failure 'reset with pathspecs inside sparse definition' '
 	init_repos &&
 
 	write_script edit-contents <<-\EOF &&
@@ -1444,6 +1447,7 @@ test_expect_success 'ls-files' '
 
 	cat >expect <<-\EOF &&
 	a
+	before/
 	deep/
 	e
 	folder1-
@@ -1491,6 +1495,7 @@ test_expect_success 'ls-files' '
 
 	cat >expect <<-\EOF &&
 	a
+	before/
 	deep/
 	e
 	folder1-
-- 
gitgitgadget
Previous: Victoria Dye via GitGitGadgetNext: Victoria Dye via GitGitGadget
Message 7 of 12 in “Fix use of 'cache_bottom' in sparse index”
  1. 0/3 Fix use of 'cache_bottom' in sparse indexVictoria Dye via GitGitGadget, Mar 16, 2022
  2. 1/3 t1092: add sparse directory before cone in test repoVictoria Dye via GitGitGadget, Mar 16, 2022
  3. 2/3 unpack-trees: increment cache_bottom for sparse directoriesVictoria Dye via GitGitGadget, Mar 16, 2022
  4. 3/3 Revert "unpack-trees: improve performance of next_cache_entry"Victoria Dye via GitGitGadget, Mar 16, 2022
  5. Junio C HamanoMar 16, 2022
  6. 0/3 Fix use of 'cache_bottom' in sparse indexVictoria Dye via GitGitGadget, Mar 17, 2022
  7. 1/3 t1092: add sparse directory before cone in test repoVictoria Dye via GitGitGadget, Mar 17, 2022
  8. 2/3 unpack-trees: increment cache_bottom for sparse directoriesVictoria Dye via GitGitGadget, Mar 17, 2022
  9. Derrick StoleeMar 21, 2022
  10. Junio C HamanoMar 21, 2022
  11. 3/3 Revert "unpack-trees: improve performance of next_cache_entry"Victoria Dye via GitGitGadget, Mar 17, 2022
  12. Derrick StoleeMar 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.