summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 19:19:26 +0700
committerJunio C Hamano <gitster@pobox.com>2014-06-13 11:49:38 -0700
commitad837d9ef9d555ab5077767c8672ff48c6cb562b (patch)
treebcc4182a6bc56281727669cd245341fc1985d665
parentce51bf09f8f0de70673b7cbdbc0e0df0b07e1def (diff)
downloadgit-ad837d9ef9d555ab5077767c8672ff48c6cb562b.tar.gz
read-cache: be strict about "changed" in remove_marked_cache_entries()
remove_marked_cache_entries() deletes entries marked with CE_REMOVE. But if there is no such entry, do not mark the index as "changed" because that could trigger an index update unnecessarily. 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--read-cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 5e8c06cfd6..c0c2e39ced 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -510,6 +510,8 @@ void remove_marked_cache_entries(struct index_state *istate)
else
ce_array[j++] = ce_array[i];
}
+ if (j == istate->cache_nr)
+ return;
istate->cache_changed = 1;
istate->cache_nr = j;
}