path: root/builtin
diff options
authorDerrick Stolee <>2021-04-01 01:49:43 (GMT)
committerJunio C Hamano <>2021-04-14 20:46:59 (GMT)
commit1b850d37f42d58d1c4ad1454d80ecf33797bc467 (patch)
tree7ce46019e5ea36a20529e782f03d1b722ff0e783 /builtin
parent54beed24d22867a98fc247e1031e3486573f1553 (diff)
checkout-index: ensure full index
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 <> Reviewed-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin')
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 023e49e..2c2936a 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -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