Skip to content
  • Taylor Blau's avatar
    pack-revindex: implement `midx_pair_to_pack_pos()` · dbd5c520
    Taylor Blau authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Now that we have extracted the `midx_key_to_pack_pos()` function, we can
    implement the `midx_pair_to_pack_pos()` function which accepts (pack_id,
    offset) tuples and returns an index into the psuedo-pack order.
    
    This will be used in a following commit in order to figure out whether
    or not the MIDX chose a given delta's base object from the same pack as
    the delta resides in. It will do so by locating the base object's offset
    in the pack, and then performing a binary search using the same pack ID
    with the base object's offset.
    
    If (and only if) it finds a match (at any position) we can guarantee
    that the MIDX selected both halves of the delta/base pair from the same
    pack.
    
    Signed-off-by: default avatarTaylor Blau <me@ttaylorr.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    dbd5c520