pack-objects: turn off bitmaps when we split packs

If a pack.packSizeLimit is set, we may split the pack data across multiple packfiles. This means we cannot generate .bitmap files, as they require that all of the reachable objects are in the same pack. We check that condition when we are generating the list of objects to pack (and disable bitmaps if we are not packing everything), but we forgot to update it when we notice that we needed to split (which doesn't happen until the actual write phase). The resulting bitmaps are quite bogus (they mention entries that do not exist in the pack!) and can cause a fetch or push to send insufficient objects. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 16, 2014 at 21:11 UTC 21134714787a02a37da15424d72c0119b2b8ed71
2 files changed +10
builtin/pack-objects.c
+1
@@ -812,6 +812,7 @@ static void write_pack_file(void)
812 fixup_pack_header_footer(fd, sha1, pack_tmp_name,
813 nr_written, sha1, offset);
814 close(fd);
815 + write_bitmap_index = 0;
816 }
817
818 if (!pack_to_stdout) {
t/t5310-pack-bitmaps.sh
+9
@@ -170,4 +170,13 @@ test_expect_success JGIT 'jgit can read our bitmaps' '
170 )
171 '
172
173 +test_expect_success 'splitting packs does not generate bogus bitmaps' '
174 + test-genrandom foo $((1024 * 1024)) >rand &&
175 + git add rand &&
176 + git commit -m "commit with big file" &&
177 + git -c pack.packSizeLimit=500k repack -adb &&
178 + git init --bare no-bitmaps.git &&
179 + git -C no-bitmaps.git fetch .. HEAD
180 +'
181 +
182 test_done