read-cache: save deleted entries in split index
Entries that belong to the base index should not be freed. Mark CE_REMOVE to track them. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e0cf0d7de2
commit
045113a53e
@ -88,3 +88,15 @@ void discard_split_index(struct index_state *istate)
|
||||
}
|
||||
free(si);
|
||||
}
|
||||
|
||||
void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce)
|
||||
{
|
||||
if (ce->index &&
|
||||
istate->split_index &&
|
||||
istate->split_index->base &&
|
||||
ce->index <= istate->split_index->base->cache_nr &&
|
||||
ce == istate->split_index->base->cache[ce->index - 1])
|
||||
ce->ce_flags |= CE_REMOVE;
|
||||
else
|
||||
free(ce);
|
||||
}
|
||||
|
Reference in New Issue
Block a user