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

[PATCH] pack-objects: don't warn about bitmaps on incremental pack

From
David Turner <dturner@twosigma.com>
Date
Dec 16, 2016, 23:59 UTC
Message-ID
<1481932775-12952-1-git-send-email-dturner@twosigma.com>
In-Reply-To
<20161216214906.z53yp2x4n6hdc27m@sigill.intra.peff.net>

When running git pack-objects --incremental, we do not expect to be able to write a bitmap; it is very likely that objects in the new pack will have references to objects outside of the pack. So we don't need to warn the user about it.

This warning was making its way into gc.log because auto-gc will do an incremental repack when there are too many loose objects but not too many packs. When the gc.log was present, future auto gc runs would refuse to run.

Signed-off-by: David Turner <dturner@twosigma.com>
---
 builtin/pack-objects.c  |  3 ++-
 t/t5310-pack-bitmaps.sh | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 0fd52bd..96de213 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1083,7 +1083,8 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
 	if (!want_object_in_pack(sha1, exclude, &found_pack, &found_offset)) {
 		/* The pack is missing an object, so it will not have closure */
 		if (write_bitmap_index) {
-			warning(_(no_closure_warning));
+			if (!incremental)
+				warning(_(no_closure_warning));
 			write_bitmap_index = 0;
 		}
 		return 0;
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index b4c7a6f..d81636e 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -247,6 +247,18 @@ test_expect_success 'pack-objects respects --incremental' '
 	test_cmp 4.objects objects
 '
 
+test_expect_success 'incremental repack does not create bitmaps' '
+	test_commit 11 &&
+	ls .git/objects/pack/ | grep bitmap >existing_bitmaps &&
+	ls .git/objects/pack/ | grep -v bitmap >existing_packs &&
+	git repack -d 2>err &&
+	test_line_count = 0 err &&
+	ls .git/objects/pack/ | grep bitmap >output &&
+	ls .git/objects/pack/ | grep -v bitmap >post_packs &&
+	test_cmp existing_bitmaps output &&
+	! test_cmp existing_packs post_packs
+'
+
 test_expect_success 'pack with missing blob' '
 	rm $(objpath $blob) &&
 	git pack-objects --stdout --revs <revs >/dev/null
-- 
2.8.0.rc4.22.g8ae061a
Previous: Jeff KingNext: Jeff King
Message 7 of 21 in “"disabling bitmap writing, as some objects are not being packed"?”
  1. David TurnerDec 16, 2016
  2. Jeff KingDec 16, 2016
  3. Junio C HamanoDec 16, 2016
  4. Jeff KingDec 16, 2016
  5. David TurnerDec 16, 2016
  6. Jeff KingDec 16, 2016
  7. pack-objects: don't warn about bitmaps on incremental packDavid Turner, Dec 16, 2016
  8. Jeff KingDec 17, 2016
  9. David TurnerDec 19, 2016
  10. Duy NguyenDec 17, 2016
  11. David TurnerFeb 8, 2017
  12. Duy NguyenFeb 8, 2017
  13. David TurnerFeb 8, 2017
  14. Duy NguyenFeb 8, 2017
  15. Junio C HamanoFeb 8, 2017
  16. David TurnerFeb 8, 2017
  17. Jeff KingFeb 8, 2017
  18. David TurnerFeb 8, 2017
  19. Jeff KingFeb 8, 2017
  20. Junio C HamanoFeb 9, 2017
  21. Jeff KingFeb 9, 2017

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.