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

Function fetch_multiple

builtin/fetch.c:2286–2345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2284}
2285
2286static int fetch_multiple(struct string_list *list, int max_children,
2287 const struct fetch_config *config)
2288{
2289 int i, result = 0;
2290 struct strvec argv = STRVEC_INIT;
2291
2292 if (!append && write_fetch_head) {
2293 int errcode = truncate_fetch_head();
2294 if (errcode)
2295 return errcode;
2296 }
2297
2298 /*
2299 * Cancel out the fetch.bundleURI config when running subprocesses,
2300 * to avoid fetching from the same bundle list multiple times.
2301 */
2302 strvec_pushl(&argv, "-c", "fetch.bundleURI=",
2303 "fetch", "--append", "--no-auto-gc",
2304 "--no-write-commit-graph", NULL);
2305 for (i = 0; i < server_options.nr; i++)
2306 strvec_pushf(&argv, "--server-option=%s", server_options.items[i].string);
2307 add_options_to_argv(&argv, config);
2308
2309 if (max_children != 1 && list->nr != 1) {
2310 struct parallel_fetch_state state = { argv.v, list, 0, 0, config };
2311 const struct run_process_parallel_opts opts = {
2312 .tr2_category = "fetch",
2313 .tr2_label = "parallel/fetch",
2314
2315 .processes = max_children,
2316
2317 .get_next_task = &fetch_next_remote,
2318 .start_failure = &fetch_failed_to_start,
2319 .task_finished = &fetch_finished,
2320 .data = &state,
2321 };
2322
2323 strvec_push(&argv, "--end-of-options");
2324
2325 run_processes_parallel(&opts);
2326 result = state.result;
2327 } else
2328 for (i = 0; i < list->nr; i++) {
2329 const char *name = list->items[i].string;
2330 struct child_process cmd = CHILD_PROCESS_INIT;
2331
2332 strvec_pushv(&cmd.args, argv.v);
2333 strvec_push(&cmd.args, name);
2334 if (verbosity >= 0 && config->display_format != DISPLAY_FORMAT_PORCELAIN)
2335 printf(_("Fetching %s\n"), name);
2336 cmd.git_cmd = 1;
2337 if (run_command(&cmd)) {
2338 error(_("could not fetch %s"), name);
2339 result = 1;
2340 }
2341 }
2342
2343 strvec_clear(&argv);

Callers 1

cmd_fetchFunction · 0.85

Calls 10

truncate_fetch_headFunction · 0.85
strvec_pushlFunction · 0.85
strvec_pushfFunction · 0.85
add_options_to_argvFunction · 0.85
strvec_pushFunction · 0.85
run_processes_parallelFunction · 0.85
strvec_pushvFunction · 0.85
run_commandFunction · 0.85
errorFunction · 0.85
strvec_clearFunction · 0.85

Tested by

no test coverage detected