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

Function query_fsmonitor_hook

fsmonitor.c:159–189  ·  view source on GitHub ↗

* Call the query-fsmonitor hook passing the last update token of the saved results. */

Source from the content-addressed store, hash-verified

157 * Call the query-fsmonitor hook passing the last update token of the saved results.
158 */
159static int query_fsmonitor_hook(struct repository *r,
160 int version,
161 const char *last_update,
162 struct strbuf *query_result)
163{
164 struct child_process cp = CHILD_PROCESS_INIT;
165 int result;
166
167 if (fsm_settings__get_mode(r) != FSMONITOR_MODE_HOOK)
168 return -1;
169
170 strvec_push(&cp.args, fsm_settings__get_hook_path(r));
171 strvec_pushf(&cp.args, "%d", version);
172 strvec_pushf(&cp.args, "%s", last_update);
173 cp.use_shell = 1;
174 cp.dir = repo_get_work_tree(the_repository);
175
176 trace2_region_enter("fsm_hook", "query", NULL);
177
178 result = capture_command(&cp, query_result, 1024);
179
180 if (result)
181 trace2_data_intmax("fsm_hook", NULL, "query/failed", result);
182 else
183 trace2_data_intmax("fsm_hook", NULL, "query/response-length",
184 query_result->len);
185
186 trace2_region_leave("fsm_hook", "query", NULL);
187
188 return result;
189}
190
191/*
192 * Invalidate the FSM bit on this CE. This is like mark_fsmonitor_invalid()

Callers 1

refresh_fsmonitorFunction · 0.85

Calls 6

fsm_settings__get_modeFunction · 0.85
strvec_pushFunction · 0.85
strvec_pushfFunction · 0.85
repo_get_work_treeFunction · 0.85
capture_commandFunction · 0.85

Tested by

no test coverage detected