]> Kevux Git Server - rit/commit
pack-revindex: prepare for incremental MIDX bitmaps
authorTaylor Blau <me@ttaylorr.com>
Thu, 20 Mar 2025 17:56:31 +0000 (13:56 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2025 11:33:33 +0000 (04:33 -0700)
commit8331c17b7961736ac69b74d26af579048ad77866
treed1f72b179c5838d89f073be59e4efa3345ff62f7
parent4887bdd4c7bd97e3eeccfc113fd97605b1a3d9ba
pack-revindex: prepare for incremental MIDX bitmaps

Prepare the reverse index machinery to handle object lookups in an
incremental MIDX bitmap. These changes are broken out across a few
functions:

  - load_midx_revindex() learns to use the appropriate MIDX filename
    depending on whether the given 'struct multi_pack_index *' is
    incremental or not.

  - pack_pos_to_midx() and midx_to_pack_pos() now both take in a global
    object position in the MIDX pseudo-pack order, and find the
    earliest containing MIDX (similar to midx.c::midx_for_object().

  - midx_pack_order_cmp() adjusts its call to pack_pos_to_midx() by the
    number of objects in the base (since 'vb - midx->revindx_data' is
    relative to the containing MIDX, and pack_pos_to_midx() expects a
    global position).

    Likewise, this function adjusts its output by adding
    m->num_objects_in_base to return a global position out through the
    `*pos` pointer.

Together, these changes are sufficient to use the multi-pack index's
reverse index format for incremental multi-pack reachability bitmaps.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap.c
pack-revindex.c