split-index: do not invalidate cache-tree at read time
[gitweb.git] / read-cache.c
index 1a7ef7f7835186cead47fcaf8ee467394bc5f334..d5f70a08b9d475eaf80f9df3aeba524b8fde6cbe 100644 (file)
@@ -950,7 +950,8 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
        int skip_df_check = option & ADD_CACHE_SKIP_DFCHECK;
        int new_only = option & ADD_CACHE_NEW_ONLY;
 
-       cache_tree_invalidate_path(istate, ce->name);
+       if (!(option & ADD_CACHE_KEEP_CACHE_TREE))
+               cache_tree_invalidate_path(istate, ce->name);
        pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce));
 
        /* existing match? Just replace it. */