Re: [PATCH] git: extend --no-lazy-fetch to work across subprocesses
- From
Jeff King <peff@peff.net>
- Date
- Feb 27, 2024, 07:49 UTC
- Message-ID
- <20240227074903.GD3263678@coredump.intra.peff.net>
- In-Reply-To
- <xmqqfrxexx15.fsf@gitster.g>
On Mon, Feb 26, 2024 at 10:04:54PM -0800, Junio C Hamano wrote:
> ----- >8 --------- >8 --------- >8 --------- >8 ----- > Subject: [PATCH v2 3/3] git: extend --no-lazy-fetch to work across subprocesses > [...]
This looks pretty reasonable to me, and the lines you drew for #leftoverbits all seemed liked good spots.
The only thing I noticed in the patch was this (which I think is not even new in this round):
Show 12 quoted lines
> diff --git a/environment.c b/environment.c
> index 9e37bf58c0..afad78a3f8 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -136,6 +136,7 @@ const char * const local_repo_env[] = {
> GRAFT_ENVIRONMENT,
> INDEX_ENVIRONMENT,
> NO_REPLACE_OBJECTS_ENVIRONMENT,
> + NO_LAZY_FETCH_ENVIRONMENT,
> GIT_REPLACE_REF_BASE_ENVIRONMENT,
> GIT_PREFIX_ENVIRONMENT,
> GIT_SHALLOW_FILE_ENVIRONMENT,This will clear the environment variable when we move between repositories. I can see an argument for it, and certainly that's how GIT_NO_REPLACE_OBJECTS works.
But I can also see an argument that this is not a property of the _repository_, but of the request. For example, if I run "git --no-lazy-fetch log" and we cross into a submodule to do a diff, should that submodule also avoid lazy-fetching? I'd think so, but I think your patch would restore the defaults when we "enter" the submodule repo.
There's some prior art there, I think, in how GIT_CEILING_DIRECTORIES works, or even something like "git --literal-pathspecs", neither of which appear in local_repo_env.
-Peff