diff options
Diffstat (limited to 'split-index.c')
-rw-r--r-- | split-index.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/split-index.c b/split-index.c index 2bb5d556f0..b36c73b3aa 100644 --- a/split-index.c +++ b/split-index.c @@ -100,3 +100,18 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce else free(ce); } + +void replace_index_entry_in_base(struct index_state *istate, + struct cache_entry *old, + struct cache_entry *new) +{ + if (old->index && + istate->split_index && + istate->split_index->base && + old->index <= istate->split_index->base->cache_nr) { + new->index = old->index; + if (old != istate->split_index->base->cache[new->index - 1]) + free(istate->split_index->base->cache[new->index - 1]); + istate->split_index->base->cache[new->index - 1] = new; + } +} |