diff mbox series

[v2,18/25] entry: ensure full index

Message ID 2b9180ee77d30c797f58f7e50ff9174e70797069.1617241803.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee April 1, 2021, 1:49 a.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

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>
---
 entry.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/entry.c b/entry.c
index 7b9f43716f76..891e4ba2b45a 100644
--- a/entry.c
+++ b/entry.c
@@ -412,6 +412,8 @@  static void mark_colliding_entries(const struct checkout *state,
 
 	ce->ce_flags |= CE_MATCHED;
 
+	/* TODO: audit for interaction with sparse-index. */
+	ensure_full_index(state->istate);
 	for (i = 0; i < state->istate->cache_nr; i++) {
 		struct cache_entry *dup = state->istate->cache[i];