From 4592e6080ff0f9eb0218162be0e40b2d6abc979a Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sat, 18 Aug 2018 16:41:28 +0200 Subject: cache-tree: verify valid cache-tree in the test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- read-cache.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'read-cache.c') diff --git a/read-cache.c b/read-cache.c index 5ce40f39b3..41f313bc9e 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2744,6 +2744,9 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock, int new_shared_index, ret; struct split_index *si = istate->split_index; + if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0)) + cache_tree_verify(istate); + if ((flags & SKIP_IF_UNCHANGED) && !istate->cache_changed) { if (flags & COMMIT_LOCK) rollback_lock_file(lock); -- cgit v1.3-5-g9baa