summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-08-18 14:41:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-18 16:47:46 (GMT)
commit4592e6080ff0f9eb0218162be0e40b2d6abc979a (patch)
tree4b9ec1726800a8990ec49caa31c03f7536f9fca8 /unpack-trees.c
parent5697ca9aa562c1f0b624b4f273685351734162e3 (diff)
downloadgit-4592e6080ff0f9eb0218162be0e40b2d6abc979a.zip
git-4592e6080ff0f9eb0218162be0e40b2d6abc979a.tar.gz
git-4592e6080ff0f9eb0218162be0e40b2d6abc979a.tar.bz2
cache-tree: verify valid cache-tree in the test suite
This makes sure that cache-tree is consistent with the index. The main purpose is to catch potential problems by saving the index in unpack_trees() but the line in write_index() would also help spot missing invalidation in other code. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index bc43922..3394540 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1578,6 +1578,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (o->dst_index) {
move_index_extensions(&o->result, o->src_index);
if (!ret) {
+ if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0))
+ cache_tree_verify(&o->result);
if (!o->result.cache_tree)
o->result.cache_tree = cache_tree();
if (!cache_tree_fully_valid(o->result.cache_tree))