Re: [PATCH v3] repository: move fetch_if_missing into struct repository
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 7, 2026, 17:03 UTC
- Message-ID
- <xmqqwlu1eubr.fsf@gitster.g>
- In-Reply-To
- <20260807094132.806165-1-cat@malon.dev>
Tian Yuchen <cat@malon.dev> writes:
Show 19 quoted lines
> The global variable 'fetch_if_missing' controls whether a missing > object check should prompt a lazy fetch from a promisor remote. > In order to continue the libification effort, move it into > 'struct repository' and initialize it to 1 by default to keep the > previous behavior. > > Note that in builtin/fsck.c and builtin/index-pack.c, when running > related commands with the '-h' parameter, the 'repo' pointer is not > passed in. To prevent null pointer dereferences, we defer > operations on the repo until after parameter parsing is complete. > > Additionally, update the partial clone documentation to reflect > that this is now a per-repository flag. > > Mentored-by: Christian Couder <christian.couder@gmail.com> > Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com> > Mentored-by: Olamide Caleb Bello <belkid98@gmail.com> > Signed-off-by: Tian Yuchen <cat@malon.dev> > ---
Have you made a trial merge to 'seen' and 'next' to see how well this change plays with other topics in flight?
Show 11 quoted lines
> diff --git a/setup.c b/setup.c > index b4652651df..ce2a80ac31 100644 > --- a/setup.c > +++ b/setup.c > @@ -1064,7 +1064,7 @@ static void setup_git_env_internal(struct repository *repo, > set_alternate_shallow_file(repo, shallow_file, 0); > > if (git_env_bool(NO_LAZY_FETCH_ENVIRONMENT, 0)) > - fetch_if_missing = 0; > + the_repository->fetch_if_missing = 0; > }
Pelease remind me the reason why we use the_repository here, even though a few lines above we are already using the caller-supplied repo.
Also setup_git_env_internal() no longer exists in 'seen', if this topic wants to play well with cf1687a41c (setup: split up concerns of `setup_git_env_internal()`, 2026-07-07), you'd need to coordinate the other topics and their author(s) before relying on the presence of what they are removing.