Skip to content

Commit 0f6d3ba

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b850d3 commit 0f6d3ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

builtin/checkout.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ static int checkout_worktree(const struct checkout_opts *opts,
368368
NULL);
369369

370370
enable_delayed_checkout(&state);
371+
372+
/* TODO: audit for interaction with sparse-index. */
373+
ensure_full_index(&the_index);
371374
for (pos = 0; pos < active_nr; pos++) {
372375
struct cache_entry *ce = active_cache[pos];
373376
if (ce->ce_flags & CE_MATCHED) {
@@ -512,6 +515,8 @@ static int checkout_paths(const struct checkout_opts *opts,
512515
* Make sure all pathspecs participated in locating the paths
513516
* to be checked out.
514517
*/
518+
/* TODO: audit for interaction with sparse-index. */
519+
ensure_full_index(&the_index);
515520
for (pos = 0; pos < active_nr; pos++)
516521
if (opts->overlay_mode)
517522
mark_ce_for_checkout_overlay(active_cache[pos],

0 commit comments

Comments
 (0)