From 045113a53e9e4b2c157040a1b53306d7c932c455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 13 Jun 2014 19:19:38 +0700 Subject: read-cache: save deleted entries in split index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- split-index.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'split-index.c') diff --git a/split-index.c b/split-index.c index 63b52bb086..2bb5d556f0 100644 --- a/split-index.c +++ b/split-index.c @@ -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); +} -- cgit v1.2.3