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

Function preload_thread

preload-index.c:47–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45};
46
47static void *preload_thread(void *_data)
48{
49 int nr, last_nr;
50 struct thread_data *p = _data;
51 struct index_state *index = p->index;
52 struct cache_entry **cep = index->cache + p->offset;
53 struct cache_def cache = CACHE_DEF_INIT;
54
55 nr = p->nr;
56 if (nr + p->offset > index->cache_nr)
57 nr = index->cache_nr - p->offset;
58 last_nr = nr;
59
60 do {
61 struct cache_entry *ce = *cep++;
62 struct stat st;
63
64 if (ce_stage(ce))
65 continue;
66 if (S_ISGITLINK(ce->ce_mode))
67 continue;
68 if (ce_uptodate(ce))
69 continue;
70 if (ce_skip_worktree(ce))
71 continue;
72 if (ce->ce_flags & CE_FSMONITOR_VALID)
73 continue;
74 if (p->progress && !(nr & 31)) {
75 struct progress_data *pd = p->progress;
76
77 pthread_mutex_lock(&pd->mutex);
78 pd->n += last_nr - nr;
79 display_progress(pd->progress, pd->n);
80 pthread_mutex_unlock(&pd->mutex);
81 last_nr = nr;
82 }
83 if (!ce_path_match(index, ce, &p->pathspec, NULL))
84 continue;
85 if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))
86 continue;
87 p->t2_nr_lstat++;
88 if (lstat(ce->name, &st))
89 continue;
90 if (ie_match_stat(index, ce, &st, CE_MATCH_RACY_IS_DIRTY|CE_MATCH_IGNORE_FSMONITOR))
91 continue;
92 ce_mark_uptodate(ce);
93 mark_fsmonitor_valid(index, ce);
94 } while (--nr > 0);
95 if (p->progress) {
96 struct progress_data *pd = p->progress;
97
98 pthread_mutex_lock(&pd->mutex);
99 display_progress(pd->progress, pd->n + last_nr);
100 pthread_mutex_unlock(&pd->mutex);
101 }
102 cache_def_clear(&cache);
103 return NULL;
104}

Callers

nothing calls this directly

Calls 6

display_progressFunction · 0.85
ce_path_matchFunction · 0.85
ie_match_statFunction · 0.85
mark_fsmonitor_validFunction · 0.85
cache_def_clearFunction · 0.85

Tested by

no test coverage detected