• Duy Nguyen's avatar
    pack-objects: move in_pack out of struct object_entry · 43fa44fa
    Duy Nguyen authored
    Instead of using 8 bytes (on 64 bit arch) to store a pointer to a
    pack. Use an index instead since the number of packs should be
    relatively small.
    
    This limits the number of packs we can handle to 1k. Since we can't be
    sure people can never run into the situation where they have more than
    1k pack files. Provide a fall back route for it.
    
    If we find out they have too many packs, the new in_pack_by_idx[]
    array (which has at most 1k elements) will not be used. Instead we
    allocate in_pack[] array that holds nr_objects elements. This is
    similar to how the optional in_pack_pos field is handled.
    
    The new simple test is just to make sure the too-many-packs code path
    is at least executed. The true test is running
    
        make test GIT_TEST_FULL_IN_PACK_ARRAY=1
    
    to take advantage of other special case tests.
    Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    43fa44fa
t5300-pack-object.sh 13.5 KB