summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-06-02 02:34:03 -0500
committerCarlos Martín Nieto <cmn@dwim.me>2016-10-01 17:40:37 +0200
commit11408f0e43ba38829863a992fc73a77c6c18e035 (patch)
treee96cd56db33c362b8361d097f07279de115e566d
parent8be49681a68ab77d87b9d90b715314caa455ea7b (diff)
downloadlibgit2-11408f0e43ba38829863a992fc73a77c6c18e035.tar.gz
index_read_index: invalidate new paths in tree cache
When adding a new entry to an existing index via `git_index_read_index`, be sure to remove the tree cache entry for that new path. This will mark all parent trees as dirty.
-rw-r--r--src/index.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/index.c b/src/index.c
index 430a34f8e..20ab6a19d 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3004,6 +3004,12 @@ int git_index_read_index(
((struct entry_internal *)add_entry)->pathlen);
}
+ /* invalidate this path in the tree cache if this is new (to
+ * invalidate the parent trees)
+ */
+ if (dup_entry && !remove_entry && index->tree)
+ git_tree_cache_invalidate_path(index->tree, dup_entry->path);
+
if (add_entry) {
if ((error = git_vector_insert(&new_entries, add_entry)) == 0)
INSERT_IN_MAP_EX(index, new_entries_map, add_entry, error);