From: Junio C Hamano Date: Wed, 12 Aug 2020 18:28:07 GMT Subject: Re: [PATCH v2 6/7] promisor-remote: lazy-fetch objects in subprocess Message-ID: In-Reply-To: <55d2e5a4cccee0ae719f4210c2cbeeb6a691cf2f.1597184949.git.jonathantanmy@google.com> Jonathan Tan writes: > Teach Git to lazy-fetch missing objects in a subprocess instead of doing > it in-process. This allows any fatal errors that occur during the fetch > to be isolated and converted into an error return value, instead of > causing the current command being run to terminate. > > ... > static int fetch_objects(const char *remote_name, > const struct object_id *oids, > int oid_nr) > { > - struct ref *ref = NULL; > + struct child_process child = CHILD_PROCESS_INIT; > int i; > + FILE *child_in; > + > + child.git_cmd = 1; > + child.in = -1; > + argv_array_pushl(&child.args, "-c", "fetch.negotiationAlgorithm=null", > + "fetch", remote_name, "--no-tags", > + "--no-write-fetch-head", "--recurse-submodules=no", > + "--filter=blob:none", "--stdin", NULL); Finally we get to use the new negotiator introduced earlier. Nice. > + if (start_command(&child)) > + die(_("promisor-remote: unable to fork off fetch subprocess")); > + child_in = xfdopen(child.in, "w");