From e6d5479e7ac301ae8d11daa3d8ef748e891c91c3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 27 Feb 2024 08:48:29 -0800 Subject: git: extend --no-lazy-fetch to work across subprocesses Modeling after how the `--no-replace-objects` option is made usable across subprocess spawning (e.g., cURL based remote helpers are spawned as a separate process while running "git fetch"), allow the `--no-lazy-fetch` option to be passed across process boundaries. Do not model how the value of GIT_NO_REPLACE_OBJECTS environment variable is ignored, though. Just use the usual git_env_bool() to allow "export GIT_NO_LAZY_FETCH=0" and "unset GIT_NO_LAZY_FETCH" to be equivalents. Also do not model how the request is not propagated to subprocesses we spawn (e.g. "git clone --local" that spawns a new process to work in the origin repository, while the original one working in the newly created one) by the "--no-replace-objects" option, as this "do not lazily fetch from the promisor" is more about a per-request debugging aid, not "this repository's promisor should not be relied upon" property specific to a repository. Signed-off-by: Junio C Hamano --- git.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'git.c') diff --git a/git.c b/git.c index 28e8bf7497..d11d4dc77b 100644 --- a/git.c +++ b/git.c @@ -189,6 +189,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged = 1; } else if (!strcmp(cmd, "--no-lazy-fetch")) { fetch_if_missing = 0; + setenv(NO_LAZY_FETCH_ENVIRONMENT, "1", 1); + if (envchanged) + *envchanged = 1; } else if (!strcmp(cmd, "--no-replace-objects")) { disable_replace_refs(); setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1); -- cgit v1.3