Re: [PATCH v2 6/7] promisor-remote: lazy-fetch objects in subprocess
Jonathan Tan <jonathantanmy@google.com> writes:
Show 21 quoted lines
> 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");