From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:44 +0000 (+0000) Subject: checkout: ensure full index X-Git-Tag: v2.32.0-rc0~59^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f6d3ba6bd795b09bf216c267bbf6e3ec2409d1e;p=thirdparty%2Fgit.git checkout: ensure full index Before iterating over all cache entries in the checkout builtin, ensure that we have a full index to avoid any unexpected behavior. Signed-off-by: Derrick Stolee Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- diff --git a/builtin/checkout.c b/builtin/checkout.c index 0e66390520..d0dbe63ea1 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -368,6 +368,9 @@ static int checkout_worktree(const struct checkout_opts *opts, NULL); enable_delayed_checkout(&state); + + /* TODO: audit for interaction with sparse-index. */ + ensure_full_index(&the_index); for (pos = 0; pos < active_nr; pos++) { struct cache_entry *ce = active_cache[pos]; if (ce->ce_flags & CE_MATCHED) { @@ -512,6 +515,8 @@ static int checkout_paths(const struct checkout_opts *opts, * Make sure all pathspecs participated in locating the paths * to be checked out. */ + /* TODO: audit for interaction with sparse-index. */ + ensure_full_index(&the_index); for (pos = 0; pos < active_nr; pos++) if (opts->overlay_mode) mark_ce_for_checkout_overlay(active_cache[pos],