]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-bitmap: tag bitmapped packs with their corresponding MIDX
authorTaylor Blau <me@ttaylorr.com>
Tue, 27 Aug 2024 21:13:30 +0000 (17:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Aug 2024 21:50:26 +0000 (14:50 -0700)
The next commit will need to use the bitmap's MIDX (if one exists) to
translate bit positions into pack-relative positions in the source pack.

Ordinarily, we'd use the "midx" field of the bitmap_index struct. But
since that struct is defined within pack-bitmap.c, and our caller is in
a separate compilation unit, we do not have access to the MIDX field.

Instead, add a "from_midx" field to the bitmapped_pack structure so that
we can use that piece of data from outside of pack-bitmap.c. The caller
that uses this new piece of information will be added in the following
commit.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c
pack-bitmap.c
pack-bitmap.h

diff --git a/midx.c b/midx.c
index ca98bfd7c644fece17d47679c6044747c3798c16..67e0d64004666d288278fd9ea9f27ad988b7e56c 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -496,6 +496,7 @@ int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
                                 MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * local_pack_int_id +
                                 sizeof(uint32_t));
        bp->pack_int_id = pack_int_id;
+       bp->from_midx = m;
 
        return 0;
 }
index 2e657a2aa4ccdacbbe2fdb113e64696deba722f5..218d7ac2eb3d11fb595b63204d4b646b3593df14 100644 (file)
@@ -2322,6 +2322,7 @@ void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
                packs[packs_nr].pack_int_id = pack_int_id;
                packs[packs_nr].bitmap_nr = pack->num_objects;
                packs[packs_nr].bitmap_pos = 0;
+               packs[packs_nr].from_midx = bitmap_git->midx;
 
                objects_nr = packs[packs_nr++].bitmap_nr;
        }
index ff0fd815b82fb558da678d70b8fdc3ac6074e475..d7f4b8b8e95f85e7ccea622880bd2ca419704387 100644 (file)
@@ -60,6 +60,7 @@ struct bitmapped_pack {
        uint32_t bitmap_pos;
        uint32_t bitmap_nr;
 
+       struct multi_pack_index *from_midx; /* MIDX only */
        uint32_t pack_int_id; /* MIDX only */
 };