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

Function refresh_index

read-cache.c:1482–1614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1480
1481
1482int refresh_index(struct index_state *istate, unsigned int flags,
1483 const struct pathspec *pathspec,
1484 char *seen, const char *header_msg)
1485{
1486 int i;
1487 int has_errors = 0;
1488 int really = (flags & REFRESH_REALLY) != 0;
1489 int allow_unmerged = (flags & REFRESH_UNMERGED) != 0;
1490 int quiet = (flags & REFRESH_QUIET) != 0;
1491 int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
1492 int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
1493 int ignore_skip_worktree = (flags & REFRESH_IGNORE_SKIP_WORKTREE) != 0;
1494 int first = 1;
1495 int in_porcelain = (flags & REFRESH_IN_PORCELAIN);
1496 unsigned int options = (CE_MATCH_REFRESH |
1497 (really ? CE_MATCH_IGNORE_VALID : 0) |
1498 (not_new ? CE_MATCH_IGNORE_MISSING : 0));
1499 const char *modified_fmt;
1500 const char *deleted_fmt;
1501 const char *typechange_fmt;
1502 const char *added_fmt;
1503 const char *unmerged_fmt;
1504 struct progress *progress = NULL;
1505 int t2_sum_lstat = 0;
1506 int t2_sum_scan = 0;
1507
1508 if (flags & REFRESH_PROGRESS && isatty(2))
1509 progress = start_delayed_progress(the_repository,
1510 _("Refresh index"),
1511 istate->cache_nr);
1512
1513 trace_performance_enter();
1514 modified_fmt = in_porcelain ? "M\t%s\n" : "%s: needs update\n";
1515 deleted_fmt = in_porcelain ? "D\t%s\n" : "%s: needs update\n";
1516 typechange_fmt = in_porcelain ? "T\t%s\n" : "%s: needs update\n";
1517 added_fmt = in_porcelain ? "A\t%s\n" : "%s: needs update\n";
1518 unmerged_fmt = in_porcelain ? "U\t%s\n" : "%s: needs merge\n";
1519 /*
1520 * Use the multi-threaded preload_index() to refresh most of the
1521 * cache entries quickly then in the single threaded loop below,
1522 * we only have to do the special cases that are left.
1523 */
1524 preload_index(istate, pathspec, 0);
1525 trace2_region_enter("index", "refresh", NULL);
1526
1527 for (i = 0; i < istate->cache_nr; i++) {
1528 struct cache_entry *ce, *new_entry;
1529 int cache_errno = 0;
1530 int changed = 0;
1531 int filtered = 0;
1532 int t2_did_lstat = 0;
1533 int t2_did_scan = 0;
1534
1535 ce = istate->cache[i];
1536 if (ignore_submodules && S_ISGITLINK(ce->ce_mode))
1537 continue;
1538 if (ignore_skip_worktree && ce_skip_worktree(ce))
1539 continue;

Callers 15

checkout_fast_forwardFunction · 0.85
read_and_refresh_cacheFunction · 0.85
require_clean_work_treeFunction · 0.85
cmd__read_cacheFunction · 0.85
fast_forward_toFunction · 0.85
cmd_rebaseFunction · 0.85
reset_treeFunction · 0.85
create_index_from_treeFunction · 0.85
cmd_describeFunction · 0.85
cmd_resetFunction · 0.85

Calls 10

start_delayed_progressFunction · 0.85
trace_performance_enterFunction · 0.85
preload_indexFunction · 0.85
ce_path_matchFunction · 0.85
refresh_cache_entFunction · 0.85
display_progressFunction · 0.85
mark_fsmonitor_invalidFunction · 0.85
replace_index_entryFunction · 0.85
stop_progressFunction · 0.85
show_fileFunction · 0.70

Tested by 1

cmd__read_cacheFunction · 0.68