read-cache: save deleted entries in split index
[gitweb.git] / split-index.c
index 63b52bb086e336ab14cd070f63bf880a912162f4..2bb5d556f0d7929f4d58737154874f9879862009 100644 (file)
@@ -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);
+}