]> granicus.if.org Git - git/commitdiff
Merge branch 'jk/packfile-reuse-cleanup' into next
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:42:07 +0000 (13:42 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:42:07 +0000 (13:42 +0900)
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

1  2 
builtin/pack-objects.c
pack-bitmap.c
packfile.c
packfile.h

index 5876583220c7d15ace8f7d4fbc7a5c4cef7a8d3b,6822ac10267549d4b7d1ab0727913050b743adce..1929470221e9f235a0f7f8d06cde457ca06b053d
@@@ -1000,7 -1132,11 +1131,11 @@@ static int have_duplicate_entry(const s
  {
        struct object_entry *entry;
  
 -      entry = packlist_find(&to_pack, oid, index_pos);
+       if (reuse_packfile_bitmap &&
+           bitmap_walk_contains(bitmap_git, reuse_packfile_bitmap, oid))
+               return 1;
 +      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);
  }
  
 -      return packlist_find(&to_pack, oid, NULL) ||
+ static int obj_is_packed(const struct object_id *oid)
+ {
++      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)
diff --cc pack-bitmap.c
Simple merge
diff --cc packfile.c
Simple merge
diff --cc packfile.h
Simple merge