summaryrefslogtreecommitdiffstats
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorBrian Degenhardt <bmd@bmdhacks.com>2015-07-28 21:30:40 +0200
committerJunio C Hamano <gitster@pobox.com>2015-07-28 22:43:13 +0200
commit52fca2184df8398f0ba212cd6a0ec1fb123b7473 (patch)
treeeb783ea1b263c7105a4b1798e4f4bca68bb0fd99 /unpack-trees.c
parentGit 2.3.8 (diff)
downloadgit-52fca2184df8398f0ba212cd6a0ec1fb123b7473.tar.xz
git-52fca2184df8398f0ba212cd6a0ec1fb123b7473.zip
unpack-trees: populate cache-tree on successful merge
When we unpack trees into an existing index, we discard the old index and replace it with the new, merged index. Ensure that this index has its cache-tree populated. This will make subsequent git status and commit commands faster. Signed-off-by: Brian Degenhardt <bmd@bmdhacks.com> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 be84ba2607..d92f903402 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1155,6 +1155,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 {