diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-20 15:45:09 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-20 15:45:10 -0700 |
| commit | 393879d473aa33f45e296a34f4d74ccdd849aaeb (patch) | |
| tree | 19f9f0685cea6cfc05d31851aae0e3e66b792949 /pack-bitmap.c | |
| parent | f4788a577b4b3e3f070154a926d6067cfdbaf75e (diff) | |
| parent | e162aed591154612cbc646ab19808096d226fce5 (diff) | |
| download | git-393879d473aa33f45e296a34f4d74ccdd849aaeb.tar.xz | |
Merge branch 'tb/multi-pack-reuse-fix'
Assorted fixes to multi-pack-index code paths.
* tb/multi-pack-reuse-fix:
pack-revindex.c: guard against out-of-bounds pack lookups
pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse
midx-write.c: do not read existing MIDX with `packs_to_include`
Diffstat (limited to 'pack-bitmap.c')
| -rw-r--r-- | pack-bitmap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c index fe8e8a51d3..1d6b7f2826 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -2073,6 +2073,7 @@ void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git, QSORT(packs, packs_nr, bitmapped_pack_cmp); } else { struct packed_git *pack; + uint32_t pack_int_id; if (bitmap_is_midx(bitmap_git)) { uint32_t preferred_pack_pos; @@ -2083,12 +2084,24 @@ void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git, } pack = bitmap_git->midx->packs[preferred_pack_pos]; + pack_int_id = preferred_pack_pos; } else { pack = bitmap_git->pack; + /* + * Any value for 'pack_int_id' will do here. When we + * process the pack via try_partial_reuse(), we won't + * use the `pack_int_id` field since we have a non-MIDX + * bitmap. + * + * Use '-1' as a sentinel value to make it clear + * that we do not expect to read this field. + */ + pack_int_id = -1; } ALLOC_GROW(packs, packs_nr + 1, packs_alloc); packs[packs_nr].p = pack; + packs[packs_nr].pack_int_id = pack_int_id; packs[packs_nr].bitmap_nr = pack->num_objects; packs[packs_nr].bitmap_pos = 0; |
