revision: ensure full index

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> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Apr 1, 2021 at 01:50 UTC f5fed74fb2eac4d7c6fd4b09f2167b83942c0f13
1 file changed +2
revision.c
+2
@@ -1680,6 +1680,8 @@ static void do_add_index_objects_to_pending(struct rev_info *revs,
1680 {
1681 int i;
1682
1683 + /* TODO: audit for interaction with sparse-index. */
1684 + ensure_full_index(istate);
1685 for (i = 0; i < istate->cache_nr; i++) {
1686 struct cache_entry *ce = istate->cache[i];
1687 struct blob *blob;