Subject: [PATCH 07/32] read-cache: be strict about "changed" in remove_marked_cache_entries()

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Mon, 28 Apr 2014 17:55:28 +0700

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 <[email-masked]>
---
 read-cache.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/read-cache.c b/read-cache.c
index 5761b1f..9819363 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;
 }
-- 
1.9.1.346.ga2b5940