Skip to content
  • Duy Nguyen's avatar
    split-index: add and use unshare_split_index() · f9d7abec
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When split-index is being used, we have two cache_entry arrays in
    index_state->cache[] and index_state->split_index->base->cache[].
    
    index_state->cache[] may share the same entries with base->cache[] so
    we can quickly determine what entries are shared. This makes memory
    management tricky, we can't free base->cache[] until we know
    index_state->cache[] does not point to any of those entries.
    
    unshare_split_index() is added for this purpose, to find shared
    entries and either duplicate them in index_state->cache[], or discard
    them. Either way it should be safe to free base->cache[] after
    unshare_split_index().
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    f9d7abec