diff mbox series

[v3,23/26] revision: ensure full index

Message ID f928e104f0d307b84477e4d37a701ecfe372b187.1618261698.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit f5fed74fb2eac4d7c6fd4b09f2167b83942c0f13
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee April 12, 2021, 9:08 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 | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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