read-cache: be strict about "changed" in remove_marked_cache_entries()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 13 Jun 2014 12:19:26 +0000 (19:19 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jun 2014 18:49:38 +0000 (11:49 -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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c
index 5e8c06cfd616d26f679190b57344039a230134a9..c0c2e39cedcde3d080e35c9d87c1643a476e50f8 100644 (file)
@@ -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;
 }