diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2014-06-13 19:19:31 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-13 11:49:39 -0700 |
commit | a5400efe29fdaabbe5266d11d255b2ef5a4c3a66 (patch) | |
tree | ed68e858e8aa27982cdceadb8cbd9ff759d4a2c0 /cache-tree.c | |
parent | a5c446f11693b94194f32bad85df050fa1cde9af (diff) | |
download | git-a5400efe29fdaabbe5266d11d255b2ef5a4c3a66.tar.gz |
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.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cache-tree.c b/cache-tree.c index 52f8692efa..23ddc73720 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, |