entry: ensure full index

Before iterating over all cache entries, ensure that a sparse index is expanded to a full index to avoid unexpected behavior. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Apr 1, 2021 at 01:49 UTC 3450a304aaa20707a696176441a8bbfe6d5431a3
1 file changed +2
entry.c
+2
@@ -412,6 +412,8 @@ static void mark_colliding_entries(const struct checkout *state,
412
413 ce->ce_flags |= CE_MATCHED;
414
415 + /* TODO: audit for interaction with sparse-index. */
416 + ensure_full_index(state->istate);
417 for (i = 0; i < state->istate->cache_nr; i++) {
418 struct cache_entry *dup = state->istate->cache[i];
419