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

[PATCH 07/10] t0090: make test pass with SHA-256

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 9, 2019, 22:43 UTC
Message-ID
<20190609224400.41557-8-sandals@crustytoothpaste.net>
In-Reply-To
<20190609224400.41557-1-sandals@crustytoothpaste.net>

One assertion of this test checks for a shrinking cache tree. The initial index contains a cache tree with two directory names but no object ID, and the second index contains a cache tree with an object ID but no directory name.

With SHA-1, the second index is smaller than the first, because the directory information stored takes more than the 20 bytes of an SHA-1 hash, but with SHA-256, the hash is longer, and the test fails the assertion that the second index is smaller than the first.

To address this issue, increase the length of the subdirectory name to ensure that the cache tree does indeed shrink in size regardless of the algorithm in use.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 t/t0090-cache-tree.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 504334e552..ce9a4a5f32 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -162,8 +162,8 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi
 '
 
 test_expect_success PERL 'commit -p with shrinking cache-tree' '
-	mkdir -p deep/subdir &&
-	echo content >deep/subdir/file &&
+	mkdir -p deep/very-long-subdir &&
+	echo content >deep/very-long-subdir/file &&
 	git add deep &&
 	git commit -m add &&
 	git rm -r deep &&
Previous: brian m. carlsonNext: brian m. carlson
Message 14 of 17 in “Hash-independent tests, part 4”
  1. 00/10 Hash-independent tests, part 4brian m. carlson, Jun 9, 2019
  2. 01/10 t: add helper to convert object IDs to pathsbrian m. carlson, Jun 9, 2019
  3. 02/10 t1410: make hash size independentbrian m. carlson, Jun 9, 2019
  4. 03/10 t1450: make hash size independentbrian m. carlson, Jun 9, 2019
  5. Eric SunshineJun 10, 2019
  6. brian m. carlsonJun 10, 2019
  7. Jonathan TanJun 11, 2019
  8. Eric SunshineJun 11, 2019
  9. brian m. carlsonJun 11, 2019
  10. brian m. carlsonJun 11, 2019
  11. 04/10 t5000: make hash independentbrian m. carlson, Jun 9, 2019
  12. 06/10 t0027: make hash size independentbrian m. carlson, Jun 9, 2019
  13. 05/10 t6030: make test work with SHA-256brian m. carlson, Jun 9, 2019
  14. 07/10 t0090: make test pass with SHA-256brian m. carlson, Jun 9, 2019
  15. 08/10 t1007: remove SHA1 prerequisitesbrian m. carlson, Jun 9, 2019
  16. 10/10 t2203: avoid hard-coded object ID valuesbrian m. carlson, Jun 9, 2019
  17. 09/10 t1710: make hash independentbrian m. carlson, Jun 9, 2019

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.