]> git.ipfire.org Git - thirdparty/git.git/commitdiff
revision: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:50:00 +0000 (01:50 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:47:48 +0000 (13:47 -0700)
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>
revision.c

index b78733f5089b0dcef8eed71c44243a3b9a6f86db..b72e0ac1bdca09c0a51347664e9abbdfc9aa87d6 100644 (file)
@@ -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;