diff mbox series

[21/27] merge-recursive: ensure full index

Message ID 57d59825627f10c4383c2c4ee8ee449e2c50f865.1615929436.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee March 16, 2021, 9:17 p.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>
---
 merge-recursive.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/merge-recursive.c b/merge-recursive.c
index b8de7a704eae..7954c7829d27 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -522,6 +522,7 @@  static struct string_list *get_unmerged(struct index_state *istate)
 
 	unmerged->strdup_strings = 1;
 
+	ensure_full_index(istate);
 	for (i = 0; i < istate->cache_nr; i++) {
 		struct string_list_item *item;
 		struct stage_data *e;