diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-05-29 06:34:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-29 06:34:43 +0300 |
commit | f382b756a67e9c9e57fb4d4f07513cc9acd1aae9 (patch) | |
tree | adc45eb01bfeb9a50b28800ef16a6f4b956cbae6 /read-cache.c | |
parent | a531ecf399a5d2ddb97dbd79bbcdad2dd93e7268 (diff) | |
parent | de950c577317f499df44c383ecbb7967f4905db9 (diff) |
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.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/read-cache.c b/read-cache.c index 3339de81246..22ab8b5b616 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; |