From 54f9239623e26c406ebc36f1b4a8a41fd598afb5 Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Fri, 10 Sep 2021 12:50:53 -0400 Subject: [PATCH] checkout-index: improve `ensure_full_index` scope in `checkout_all` Update `checkout_all` to only run `ensure_full_index` when entries in sparse directories are needed (i.e., `--sparse` is specified). Signed-off-by: Victoria Dye --- builtin/checkout-index.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index e326cd12de8dbc..a0dbab1246e580 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -122,8 +122,9 @@ static int checkout_all(const char *prefix, int prefix_length, int include_spars int i, errs = 0; struct cache_entry *last_ce = NULL; - /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(&the_index); + if (include_sparse) + ensure_full_index(&the_index); + for (i = 0; i < active_nr ; i++) { struct cache_entry *ce = active_cache[i]; if (!include_sparse && !path_in_sparse_checkout(ce->name, &the_index))