summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 12:19:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-13 18:49:39 (GMT)
commite6c286e8b2d0748cfaa670f6738db0c232427cd3 (patch)
tree061fd404ed97633794ccf63e8d41f27cfb9d7b71
parentd0cfc3e866a77eed98ab2caf41a39a87837950e6 (diff)
downloadgit-e6c286e8b2d0748cfaa670f6738db0c232427cd3.zip
git-e6c286e8b2d0748cfaa670f6738db0c232427cd3.tar.gz
git-e6c286e8b2d0748cfaa670f6738db0c232427cd3.tar.bz2
cache-tree: mark istate->cache_changed on prime_cache_tree()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/read-tree.c2
-rw-r--r--builtin/reset.c2
-rw-r--r--cache-tree.c9
-rw-r--r--cache-tree.h2
4 files changed, 8 insertions, 7 deletions
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index f26d90f..3204c62 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -231,7 +231,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
* what came from the tree.
*/
if (nr_trees == 1 && !opts.prefix)
- prime_cache_tree(&active_cache_tree, trees[0]);
+ prime_cache_tree(&the_index, trees[0]);
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
die("unable to write new index file");
diff --git a/builtin/reset.c b/builtin/reset.c
index 0c56d28..234b2eb 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -84,7 +84,7 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)
if (reset_type == MIXED || reset_type == HARD) {
tree = parse_tree_indirect(sha1);
- prime_cache_tree(&active_cache_tree, tree);
+ prime_cache_tree(&the_index, tree);
}
return 0;
diff --git a/cache-tree.c b/cache-tree.c
index 18055f1..c53f7de 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -654,11 +654,12 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
it->entry_count = cnt;
}
-void prime_cache_tree(struct cache_tree **it, struct tree *tree)
+void prime_cache_tree(struct index_state *istate, struct tree *tree)
{
- cache_tree_free(it);
- *it = cache_tree();
- prime_cache_tree_rec(*it, tree);
+ cache_tree_free(&istate->cache_tree);
+ istate->cache_tree = cache_tree();
+ prime_cache_tree_rec(istate->cache_tree, tree);
+ istate->cache_changed |= CACHE_TREE_CHANGED;
}
/*
diff --git a/cache-tree.h b/cache-tree.h
index 154b357..b47ccec 100644
--- a/cache-tree.h
+++ b/cache-tree.h
@@ -46,7 +46,7 @@ int update_main_cache_tree(int);
#define WRITE_TREE_PREFIX_ERROR (-3)
int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
-void prime_cache_tree(struct cache_tree **, struct tree *);
+void prime_cache_tree(struct index_state *, struct tree *);
extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);