From: Junio C Hamano Date: Fri, 14 Feb 2020 20:54:19 +0000 (-0800) Subject: Merge branch 'jk/packfile-reuse-cleanup' X-Git-Tag: v2.26.0-rc0~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a14aebeac3;p=thirdparty%2Fgit.git Merge branch 'jk/packfile-reuse-cleanup' The way "git pack-objects" reuses objects stored in existing pack to generate its result has been improved. * jk/packfile-reuse-cleanup: pack-bitmap: don't rely on bitmap_git->reuse_objects pack-objects: add checks for duplicate objects 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: simplify bitmap_has_oid_in_uninteresting() pack-bitmap: uninteresting oid can be outside bitmapped packfile pack-bitmap: introduce bitmap_walk_contains() ewah/bitmap: introduce bitmap_word_alloc() packfile: expose get_delta_base() builtin/pack-objects: report reused packfile objects --- a14aebeac330e6d58f9628a02521ea780daf0a5b diff --cc builtin/pack-objects.c index 393c20a2d7,d40ee42472..b1998202fb --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -1000,7 -1128,11 +1127,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; @@@ -2552,6 -2699,13 +2683,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 -2854,14 +2838,10 @@@ static int git_pack_config(const char * use_bitmap_index_default = 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.usesparse")) { - sparse = 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)