cache-tree: verify valid cache-tree in the test suite
[gitweb.git] / read-cache.c
index 5ce40f39b3ce51bf76ffec67727a429f75a0b57f..41f313bc9e115bf51fd637dfacd116d42a5dd98d 100644 (file)
@@ -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);