Skip to content

Commit ad837d9

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent ce51bf0 commit ad837d9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

read-cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ void remove_marked_cache_entries(struct index_state *istate)
510510
else
511511
ce_array[j++] = ce_array[i];
512512
}
513+
if (j == istate->cache_nr)
514+
return;
513515
istate->cache_changed = 1;
514516
istate->cache_nr = j;
515517
}

0 commit comments

Comments
 (0)