MCPcopy Index your code
hub / github.com/git/git / read_and_refresh_cache

Function read_and_refresh_cache

sequencer.c:2568–2595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2566}
2567
2568static int read_and_refresh_cache(struct repository *r,
2569 struct replay_opts *opts)
2570{
2571 struct lock_file index_lock = LOCK_INIT;
2572 int index_fd = repo_hold_locked_index(r, &index_lock, 0);
2573 if (repo_read_index(r) < 0) {
2574 rollback_lock_file(&index_lock);
2575 return error(_("git %s: failed to read the index"),
2576 action_name(opts));
2577 }
2578 refresh_index(r->index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
2579
2580 if (index_fd >= 0) {
2581 if (write_locked_index(r->index, &index_lock,
2582 COMMIT_LOCK | SKIP_IF_UNCHANGED)) {
2583 return error(_("git %s: failed to refresh the index"),
2584 action_name(opts));
2585 }
2586 }
2587
2588 /*
2589 * If we are resolving merges in any way other than "ort", then
2590 * expand the sparse index.
2591 */
2592 if (opts->strategy && strcmp(opts->strategy, "ort"))
2593 ensure_full_index(r->index);
2594 return 0;
2595}
2596
2597void todo_list_release(struct todo_list *todo_list)
2598{

Callers 3

pick_commitsFunction · 0.85
sequencer_continueFunction · 0.85
sequencer_pick_revisionsFunction · 0.85

Calls 8

repo_hold_locked_indexFunction · 0.85
repo_read_indexFunction · 0.85
rollback_lock_fileFunction · 0.85
errorFunction · 0.85
refresh_indexFunction · 0.85
write_locked_indexFunction · 0.85
ensure_full_indexFunction · 0.85
action_nameFunction · 0.70

Tested by

no test coverage detected