aboutsummaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 19:19:31 +0700
committerJunio C Hamano <gitster@pobox.com>2014-06-13 11:49:39 -0700
commita5400efe29fdaabbe5266d11d255b2ef5a4c3a66 (patch)
treeed68e858e8aa27982cdceadb8cbd9ff759d4a2c0 /cache-tree.c
parenta5c446f11693b94194f32bad85df050fa1cde9af (diff)
downloadgit-a5400efe29fdaabbe5266d11d255b2ef5a4c3a66.tar.gz
git-a5400efe29fdaabbe5266d11d255b2ef5a4c3a66.tar.xz
cache-tree: mark istate->cache_changed on cache tree invalidation
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 'cache-tree.c')
-rw-r--r--cache-tree.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 52f8692ef..23ddc7372 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -98,7 +98,7 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path)
return find_subtree(it, path, pathlen, 1);
}
-void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
+static int do_invalidate_path(struct cache_tree *it, const char *path)
{
/* a/b/c
* ==> invalidate self
@@ -116,7 +116,7 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
#endif
if (!it)
- return;
+ return 0;
slash = strchrnul(path, '/');
namelen = slash - path;
it->entry_count = -1;
@@ -137,11 +137,18 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
(it->subtree_nr - pos - 1));
it->subtree_nr--;
}
- return;
+ return 1;
}
down = find_subtree(it, path, namelen, 0);
if (down)
- cache_tree_invalidate_path(down->cache_tree, slash + 1);
+ do_invalidate_path(down->cache_tree, slash + 1);
+ return 1;
+}
+
+void cache_tree_invalidate_path(struct index_state *istate, const char *path)
+{
+ if (do_invalidate_path(istate->cache_tree, path))
+ istate->cache_changed |= CACHE_TREE_CHANGED;
}
static int verify_cache(const struct cache_entry * const *cache,