summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 19:19:26 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-06-13 11:49:38 -0700
commitad837d9ef9d555ab5077767c8672ff48c6cb562b (patch)
treebcc4182a6bc56281727669cd245341fc1985d665
parentread-cache: store in-memory flags in the first 12 bits of ce_flags (diff)
downloadtgif-ad837d9ef9d555ab5077767c8672ff48c6cb562b.tar.xz
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;
}