summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-17 13:18:06 -0800
committerJunio C Hamano <gitster@pobox.com>2016-11-17 13:18:06 -0800
commit4b0e9f93a63c4795d7d9cefbefdb99290cfebf4e (patch)
tree2bd53fac2f9fc07fbce1a030313fc78be85cced3
parent0eb7c005bd0861b36e5afd78ae1b53a54e674401 (diff)
downloadgit-4b0e9f93a63c4795d7d9cefbefdb99290cfebf4e.tar.gz
commit: remove redundant check for active_cache_changed
It is idiomatic to say "if the cache-tree is not fully valid, then call update_cache_tree() to update it", but this old codepath had one extra condition to call update_cache_tree(), which was "if anything in the index changed, call update_cache_tree()". This is unnecessary. Whenever any change is made to an index entry, the cache-tree entries that cover the path are invalidated and the cache-tree becomes "not fully valid" at that point. Remove it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/commit.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index e13303787a..797cf8ad0f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -405,8 +405,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
if (!only && !pathspec.nr) {
hold_locked_index(&index_lock, 1);
refresh_cache_or_die(refresh_flags);
- if (active_cache_changed
- || !cache_tree_fully_valid(active_cache_tree))
+ if (!cache_tree_fully_valid(active_cache_tree))
update_main_cache_tree(WRITE_TREE_SILENT);
if (active_cache_changed) {
if (write_locked_index(&the_index, &index_lock,