]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tb/pack-with-duplicates' into seen
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:41 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:41 +0000 (10:44 -0700)
The handling of packfiles with duplicate object entries has been
hardened.  Specifically, reverse index lookup, delta cycle
recovery, multi-pack-index verification, and pack reuse paths have
been updated to correctly handle or gracefully reject duplicate
entries.

* tb/pack-with-duplicates:
  pack-bitmap: handle duplicate pack entries during MIDX reuse
  test-tool bitmap: reject packs with duplicate objects
  midx: verify duplicate pack entries by OID and offset
  packfile: recover delta cycles through duplicate entries
  t5308: test reverse indexes with duplicate objects

1  2 
builtin/pack-objects.c
pack-bitmap.c
packfile.c
t/t5332-multi-pack-reuse.sh

Simple merge
diff --cc pack-bitmap.c
index d797614e34bc82ea0d01616648bf821a20f8a6c4,81412904365f40318fe0773009ed23d479e6a119..6ebd974fce718107eac711eb4cee91d767fff408
@@@ -2388,7 -2383,8 +2388,8 @@@ static void reuse_partial_packfile_from
        struct pack_window *w_curs = NULL;
        size_t pos = pack->bitmap_pos / BITS_IN_EWORD;
  
-       if (allow_ref_delta && !pack->bitmap_pos) {
 -      if (!pack->bitmap_pos &&
++      if (allow_ref_delta && !pack->bitmap_pos &&
+           pack->bitmap_nr == pack->p->num_objects) {
                /*
                 * If we're processing the first (in the case of a MIDX, the
                 * preferred pack) or the only (in the case of single-pack
                 *   we're currently processing). So any duplicate bases will be
                 *   resolved in favor of the pack we're processing.
                 *
 +               * When REF_DELTAs are allowed, we can therefore reuse whole
 +               * words at a time without inspecting object headers. Otherwise,
 +               * inspect each object below to avoid reusing a REF_DELTA entry.
++               *
+                * The range must also contain every physical pack entry so that
+                * bitmap and pack positions correspond.
                 */
                while (pos < result->word_alloc &&
                       pos < pack->bitmap_nr / BITS_IN_EWORD &&
diff --cc packfile.c
Simple merge
Simple merge