From: Junio C Hamano Date: Fri, 24 Oct 2014 21:56:10 +0000 (-0700) Subject: Merge branch 'jk/pack-objects-no-bitmap-when-splitting' X-Git-Tag: v2.2.0-rc0~24 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/26a22d8d00e288dd4825f5d5d77d47473bdf3a6b?ds=inline;hp=-c Merge branch 'jk/pack-objects-no-bitmap-when-splitting' Splitting pack-objects output into multiple packs is incompatible with the use of reachability bitmap. * jk/pack-objects-no-bitmap-when-splitting: pack-objects: turn off bitmaps when we split packs --- 26a22d8d00e288dd4825f5d5d77d47473bdf3a6b diff --combined builtin/pack-objects.c index d39193453a,a6c91fa002..a4022a78d0 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -89,7 -89,8 +89,7 @@@ static void index_commit_for_bitmap(str { if (indexed_commits_nr >= indexed_commits_alloc) { indexed_commits_alloc = (indexed_commits_alloc + 32) * 2; - indexed_commits = xrealloc(indexed_commits, - indexed_commits_alloc * sizeof(struct commit *)); + REALLOC_ARRAY(indexed_commits, indexed_commits_alloc); } indexed_commits[indexed_commits_nr++] = commit; @@@ -811,6 -812,7 +811,7 @@@ static void write_pack_file(void fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written, sha1, offset); close(fd); + write_bitmap_index = 0; } if (!pack_to_stdout) { @@@ -2213,6 -2215,10 +2214,6 @@@ static int git_pack_config(const char * cache_max_small_delta_size = git_config_int(k, v); return 0; } - if (!strcmp(k, "pack.writebitmaps")) { - write_bitmap_index = git_config_bool(k, v); - return 0; - } if (!strcmp(k, "pack.writebitmaphashcache")) { if (git_config_bool(k, v)) write_bitmap_options |= BITMAP_OPT_HASH_CACHE; @@@ -2493,7 -2499,6 +2494,7 @@@ static void get_object_list(int ac, con if (get_sha1_hex(line + 10, sha1)) die("not an SHA-1 '%s'", line + 10); register_shallow(sha1); + use_bitmap_index = 0; continue; } die("not a rev '%s'", line); diff --combined t/t5310-pack-bitmaps.sh index 0580258c91,2366fcffa7..6003490192 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@@ -18,7 -18,7 +18,7 @@@ test_expect_success 'setup repo with mo git checkout master && blob=$(echo tagged-blob | git hash-object -w --stdin) && git tag tagged-blob $blob && - git config pack.writebitmaps true && + git config repack.writebitmaps true && git config pack.writebitmaphashcache true ' @@@ -170,4 -170,13 +170,13 @@@ test_expect_success JGIT 'jgit can rea ) ' + test_expect_success 'splitting packs does not generate bogus bitmaps' ' + test-genrandom foo $((1024 * 1024)) >rand && + git add rand && + git commit -m "commit with big file" && + git -c pack.packSizeLimit=500k repack -adb && + git init --bare no-bitmaps.git && + git -C no-bitmaps.git fetch .. HEAD + ' + test_done