summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-29 12:34:43 +0900
committerJunio C Hamano <gitster@pobox.com>2017-05-29 12:34:43 +0900
commitf382b756a67e9c9e57fb4d4f07513cc9acd1aae9 (patch)
treeadc45eb01bfeb9a50b28800ef16a6f4b956cbae6 /read-cache.c
parenta531ecf399a5d2ddb97dbd79bbcdad2dd93e7268 (diff)
parentde950c577317f499df44c383ecbb7967f4905db9 (diff)
downloadgit-f382b756a67e9c9e57fb4d4f07513cc9acd1aae9.tar.gz
Merge branch 'nd/split-index-unshare'
Plug some leaks and updates internal API used to implement the split index feature to make it easier to avoid such a leak in the future. * nd/split-index-unshare: p3400: add perf tests for rebasing many changes split-index: add and use unshare_split_index()
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/read-cache.c b/read-cache.c
index 3339de8124..22ab8b5b61 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1877,15 +1877,9 @@ int discard_index(struct index_state *istate)
{
int i;
- for (i = 0; i < istate->cache_nr; i++) {
- if (istate->cache[i]->index &&
- istate->split_index &&
- istate->split_index->base &&
- istate->cache[i]->index <= istate->split_index->base->cache_nr &&
- istate->cache[i] == istate->split_index->base->cache[istate->cache[i]->index - 1])
- continue;
+ unshare_split_index(istate, 1);
+ for (i = 0; i < istate->cache_nr; i++)
free(istate->cache[i]);
- }
resolve_undo_clear_index(istate);
istate->cache_nr = 0;
istate->cache_changed = 0;