| 422 | } |
| 423 | |
| 424 | static int check_updates(struct unpack_trees_options *o, |
| 425 | struct index_state *index) |
| 426 | { |
| 427 | unsigned cnt = 0; |
| 428 | int errs = 0; |
| 429 | struct progress *progress; |
| 430 | struct checkout state = CHECKOUT_INIT; |
| 431 | int i, pc_workers, pc_threshold; |
| 432 | |
| 433 | trace_performance_enter(); |
| 434 | state.super_prefix = o->super_prefix; |
| 435 | state.force = 1; |
| 436 | state.quiet = 1; |
| 437 | state.refresh_cache = 1; |
| 438 | state.istate = index; |
| 439 | clone_checkout_metadata(&state.meta, &o->meta, NULL); |
| 440 | |
| 441 | if (!o->update || o->dry_run) { |
| 442 | remove_marked_cache_entries(index, 0); |
| 443 | trace_performance_leave("check_updates"); |
| 444 | return 0; |
| 445 | } |
| 446 | |
| 447 | if (o->clone) |
| 448 | setup_collided_checkout_detection(&state, index); |
| 449 | |
| 450 | progress = get_progress(o, index); |
| 451 | |
| 452 | /* Start with clean cache to avoid using any possibly outdated info. */ |
| 453 | invalidate_lstat_cache(); |
| 454 | |
| 455 | git_attr_set_direction(GIT_ATTR_CHECKOUT); |
| 456 | |
| 457 | if (should_update_submodules()) |
| 458 | load_gitmodules_file(index, NULL); |
| 459 | |
| 460 | for (i = 0; i < index->cache_nr; i++) { |
| 461 | const struct cache_entry *ce = index->cache[i]; |
| 462 | |
| 463 | if (ce->ce_flags & CE_WT_REMOVE) { |
| 464 | display_progress(progress, ++cnt); |
| 465 | unlink_entry(ce, o->super_prefix); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | remove_marked_cache_entries(index, 0); |
| 470 | remove_scheduled_dirs(); |
| 471 | |
| 472 | if (should_update_submodules()) |
| 473 | load_gitmodules_file(index, &state); |
| 474 | |
| 475 | if (repo_has_promisor_remote(the_repository)) |
| 476 | /* |
| 477 | * Prefetch the objects that are to be checked out in the loop |
| 478 | * below. |
| 479 | */ |
| 480 | prefetch_cache_entries(index, must_checkout); |
| 481 |
no test coverage detected