diff mbox series

[25/27] revision: ensure full index

Message ID 6abb1813ae109f4be991aac7ab8897d35110aa36.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 index entries, ensure that a sparse index is
expanded to a full index to avoid unexpected behavior. This case could
be integrated later by ensuring that we walk the tree in the
sparse-directory entry, but the current behavior is only expecting
blobs. Save this integration for later when it can be properly tested.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 revision.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/revision.c b/revision.c
index b78733f5089b..1eee55934c08 100644
--- a/revision.c
+++ b/revision.c
@@ -1680,6 +1680,7 @@  static void do_add_index_objects_to_pending(struct rev_info *revs,
 {
 	int i;
 
+	ensure_full_index(istate);
 	for (i = 0; i < istate->cache_nr; i++) {
 		struct cache_entry *ce = istate->cache[i];
 		struct blob *blob;