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

[PATCH 3/5] t/t7704-repack-cruft.sh: consolidate `write_blob()`

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 17, 2025, 23:00 UTC
Message-ID
<b075ad86015131e4a83bd7bcd707ff2273b375b4.1742252411.git.me@ttaylorr.com>
In-Reply-To
<cover.1742252411.git.me@ttaylorr.com>

A previous commit moved a handful of tests from a different script into t7704, including one that relies on generating random blobs.

Incidentally, the original home of this test defined its own helper "write_blob" for doing so, which is identical in function to our "generate_random_blob" (and is slightly inferior to the latter, which cleans up after itself).

Rewrite the test that uses "write_blob" to no longer do so and then remove the function.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/t7704-repack-cruft.sh | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/t/t7704-repack-cruft.sh b/t/t7704-repack-cruft.sh
index e6e4c2fad8..3fd5aa6089 100755
--- a/t/t7704-repack-cruft.sh
+++ b/t/t7704-repack-cruft.sh
@@ -618,11 +618,6 @@ test_expect_success 'cruft repack with no reachable objects' '
 	)
 '
 
-write_blob () {
-	test-tool genrandom "$@" >in &&
-	git hash-object -w -t blob in
-}
-
 find_pack () {
 	for idx in $(ls $packdir/pack-*.idx)
 	do
@@ -641,8 +636,8 @@ test_expect_success 'cruft repack with --max-pack-size' '
 		test_commit base &&
 
 		# two cruft objects which exceed the maximum pack size
-		foo=$(write_blob foo 1048576) &&
-		bar=$(write_blob bar 1048576) &&
+		foo=$(generate_random_blob foo 1048576) &&
+		bar=$(generate_random_blob bar 1048576) &&
 		test-tool chmtime --get -1000 \
 			"$objdir/$(test_oid_to_path $foo)" >foo.mtime &&
 		test-tool chmtime --get -2000 \
-- 
2.49.0.rc0.6.g7f120c35e9
Previous: Elijah NewrenNext: Taylor Blau
Message 6 of 19 in “repack: introduce '--combine-cruft-below-size'”
  1. 0/5 repack: introduce '--combine-cruft-below-size'Taylor Blau, Mar 17, 2025
  2. 1/5 t/t5329-pack-objects-cruft.sh: evict 'repack'-related testsTaylor Blau, Mar 17, 2025
  3. Elijah NewrenMar 19, 2025
  4. 2/5 t/t7704-repack-cruft.sh: clarify wording in --max-cruft-size testsTaylor Blau, Mar 17, 2025
  5. Elijah NewrenMar 19, 2025
  6. 3/5 t/t7704-repack-cruft.sh: consolidate `write_blob()`Taylor Blau, Mar 17, 2025
  7. 4/5 repack: avoid combining cruft packs with `--max-cruft-size`Taylor Blau, Mar 17, 2025
  8. 5/5 repack: begin combining cruft packs with `--combine-cruft-below-size`Taylor Blau, Mar 17, 2025
  9. Junio C HamanoMar 18, 2025
  10. Taylor BlauMar 19, 2025
  11. Elijah NewrenMar 19, 2025
  12. Taylor BlauMar 19, 2025
  13. 0/5 repack: introduce '--combine-cruft-below-size'Taylor Blau, Mar 19, 2025
  14. 1/5 t/t5329-pack-objects-cruft.sh: evict 'repack'-related testsTaylor Blau, Mar 19, 2025
  15. 2/5 t/t7704-repack-cruft.sh: clarify wording in --max-cruft-size testsTaylor Blau, Mar 19, 2025
  16. 3/5 t/t7704-repack-cruft.sh: consolidate `write_blob()`Taylor Blau, Mar 19, 2025
  17. 4/5 repack: avoid combining cruft packs with `--max-cruft-size`Taylor Blau, Mar 19, 2025
  18. 5/5 repack: begin combining cruft packs with `--combine-cruft-below-size`Taylor Blau, Mar 19, 2025
  19. Elijah NewrenMar 20, 2025

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.