summaryrefslogtreecommitdiffstats
path: root/split-index.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 14:19:38 +0200
committerJunio C Hamano <gitster@pobox.com>2014-06-13 20:49:40 +0200
commit045113a53e9e4b2c157040a1b53306d7c932c455 (patch)
treeb2c12685914c12283017489365ed00dc1a43e32f /split-index.c
parentread-cache: mark new entries for split index (diff)
downloadgit-045113a53e9e4b2c157040a1b53306d7c932c455.tar.xz
git-045113a53e9e4b2c157040a1b53306d7c932c455.zip
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>
Diffstat (limited to 'split-index.c')
-rw-r--r--split-index.c12
1 files changed, 12 insertions, 0 deletions
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);
+}