summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 12:19:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-13 18:49:38 (GMT)
commitad837d9ef9d555ab5077767c8672ff48c6cb562b (patch)
treebcc4182a6bc56281727669cd245341fc1985d665 /read-cache.c
parentce51bf09f8f0de70673b7cbdbc0e0df0b07e1def (diff)
downloadgit-ad837d9ef9d555ab5077767c8672ff48c6cb562b.zip
git-ad837d9ef9d555ab5077767c8672ff48c6cb562b.tar.gz
git-ad837d9ef9d555ab5077767c8672ff48c6cb562b.tar.bz2
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>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 5e8c06c..c0c2e39 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;
}