From: Junio C Hamano Date: Mon, 30 Sep 2019 04:42:07 +0000 (+0900) Subject: Merge branch 'jk/packfile-reuse-cleanup' into next X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc60b31833b45e3dd027531a7d21c774dad948ec;p=git Merge branch 'jk/packfile-reuse-cleanup' into next The way "git pack-objects" reuses objects stored in existing pack to generate its result has been improved. * jk/packfile-reuse-cleanup: pack-objects: improve partial packfile reuse builtin/pack-objects: introduce obj_is_packed() pack-objects: introduce pack.allowPackReuse csum-file: introduce hashfile_total() pack-bitmap: introduce bitmap_walk_contains() pack-bitmap: don't rely on bitmap_git->reuse_objects ewah/bitmap: always allocate 2 more words ewah/bitmap: introduce bitmap_word_alloc() packfile: expose get_delta_base() builtin/pack-objects: report reused packfile objects --- dc60b31833b45e3dd027531a7d21c774dad948ec diff --cc builtin/pack-objects.c index 5876583220,6822ac1026..1929470221 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -1000,7 -1132,11 +1131,11 @@@ static int have_duplicate_entry(const s { struct object_entry *entry; + if (reuse_packfile_bitmap && + bitmap_walk_contains(bitmap_git, reuse_packfile_bitmap, oid)) + return 1; + - entry = packlist_find(&to_pack, oid, index_pos); + entry = packlist_find(&to_pack, oid); if (!entry) return 0; @@@ -1187,7 -1325,8 +1322,8 @@@ static int add_object_entry(const struc create_object_entry(oid, type, pack_name_hash(name), exclude, name && no_try_delta(name), - index_pos, found_pack, found_offset); + found_pack, found_offset); + return 1; } @@@ -2552,6 -2704,13 +2688,13 @@@ static void ll_find_deltas(struct objec free(p); } + static int obj_is_packed(const struct object_id *oid) + { - return packlist_find(&to_pack, oid, NULL) || ++ return packlist_find(&to_pack, oid) || + (reuse_packfile_bitmap && + bitmap_walk_contains(bitmap_git, reuse_packfile_bitmap, oid)); + } + static void add_tag_chain(const struct object_id *oid) { struct tag *tag; @@@ -2699,6 -2859,14 +2843,10 @@@ static int git_pack_config(const char * use_bitmap_index_default = git_config_bool(k, v); return 0; } - if (!strcmp(k, "pack.usesparse")) { - sparse = git_config_bool(k, v); - return 0; - } + if (!strcmp(k, "pack.allowpackreuse")) { + allow_pack_reuse = git_config_bool(k, v); + return 0; + } if (!strcmp(k, "pack.threads")) { delta_search_threads = git_config_int(k, v); if (delta_search_threads < 0)