summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-12 21:09:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-12 21:09:57 (GMT)
commit9ad8474b986b0295df6ba1455daa611a7a49a49e (patch)
tree54725ffc3ffc4e213e7e3b34a9bd44bc0c044731 /unpack-trees.c
parent0188f32304d916ec6a2443937e36421e8da9a8fd (diff)
parent52fca2184df8398f0ba212cd6a0ec1fb123b7473 (diff)
downloadgit-9ad8474b986b0295df6ba1455daa611a7a49a49e.zip
git-9ad8474b986b0295df6ba1455daa611a7a49a49e.tar.gz
git-9ad8474b986b0295df6ba1455daa611a7a49a49e.tar.bz2
Merge branch 'dt/unpack-trees-cache-tree-revalidate'
The code to perform multi-tree merges has been taught to repopulate the cache-tree upon a successful merge into the index, so that subsequent "diff-index --cached" (hence "status") and "write-tree" (hence "commit") will go faster. The same logic in "git checkout" may now be removed, but that is a separate issue. * dt/unpack-trees-cache-tree-revalidate: unpack-trees: populate cache-tree on successful merge
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index d6cf849..261804e 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1160,6 +1160,14 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->src_index = NULL;
ret = check_updates(o) ? (-2) : 0;
if (o->dst_index) {
+ if (!ret) {
+ if (!o->result.cache_tree)
+ o->result.cache_tree = cache_tree();
+ if (!cache_tree_fully_valid(o->result.cache_tree))
+ cache_tree_update(&o->result,
+ WRITE_TREE_SILENT |
+ WRITE_TREE_REPAIR);
+ }
discard_index(o->dst_index);
*o->dst_index = o->result;
} else {