Skip to content

Commit

Permalink
read-cache: be strict about "changed" in remove_marked_cache_entries()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Jun 13, 2014
1 parent ce51bf0 commit ad837d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ad837d9

Please sign in to comment.