]> git.ipfire.org Git - thirdparty/git.git/commitdiff
checkout-index: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:49:43 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:46:59 +0000 (13:46 -0700)
Before we iterate over all cache entries, ensure that the index is not
sparse. This loop in checkout_all() might be safe to iterate over a
sparse index, but let's put this protection here until it can be
carefully 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>
builtin/checkout-index.c

index 023e49e271c2e3ed2dc4c5f1f27d39000353aeb7..2c2936a9dae0697345f7f3b05b3423b135699d0d 100644 (file)
@@ -119,6 +119,8 @@ static void checkout_all(const char *prefix, int prefix_length)
        int i, errs = 0;
        struct cache_entry *last_ce = NULL;
 
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(&the_index);
        for (i = 0; i < active_nr ; i++) {
                struct cache_entry *ce = active_cache[i];
                if (ce_stage(ce) != checkout_stage