MCPcopy Create free account
hub / github.com/git/git / check_updates

Function check_updates

unpack-trees.c:424–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422}
423
424static 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

Callers 2

unpack_treesFunction · 0.85
update_sparsityFunction · 0.85

Calls 15

trace_performance_enterFunction · 0.85
clone_checkout_metadataFunction · 0.85
get_progressFunction · 0.85
invalidate_lstat_cacheFunction · 0.85
git_attr_set_directionFunction · 0.85
should_update_submodulesFunction · 0.85
load_gitmodules_fileFunction · 0.85
display_progressFunction · 0.85
unlink_entryFunction · 0.85
remove_scheduled_dirsFunction · 0.85

Tested by

no test coverage detected