Git development
 help / color / mirror / Atom feed
From: Tian Yuchen <cat@malon.dev>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, ps@pks.im,
	Christian Couder <christian.couder@gmail.com>,
	Ayush Chandekar <ayu.chandekar@gmail.com>,
	Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH v3] repository: move fetch_if_missing into struct repository
Date: Sun, 9 Aug 2026 23:00:27 +0800	[thread overview]
Message-ID: <2310939d-014f-483b-8ad3-241871b770d5@malon.dev> (raw)
In-Reply-To: <xmqqwlu1eubr.fsf@gitster.g>

On 8/8/26 01:03, Junio C Hamano wrote:
> Tian Yuchen <cat@malon.dev> writes:
> 
>> 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?
> 

> 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.

Thanks for reminding. I did a trial merge and the dependency does exist. 
Since that topic is still in flight, I'd prefer to wait for it to settle 
before rerolling this patch. What do you think? ;-)

 >> 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.
 >

Interestingly, in Patrick's patch, setup_environment() doesn't have a 
'repo' passed in and is only called once by init_git(). So I think we'll 
have to use the_repository, though I never thought of this... Anyway, 
I'll pay more attention to it in the next reroll.


Regards, yuchen





      reply	other threads:[~2026-08-09 15:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  1:18 [PATCH v1] repository: move fetch_if_missing into struct repository Tian Yuchen
2026-07-15  3:27 ` Junio C Hamano
2026-07-15  4:58   ` Tian Yuchen
2026-07-15  6:35 ` Patrick Steinhardt
2026-07-16  7:06   ` Tian Yuchen
2026-07-16 15:28   ` Junio C Hamano
2026-07-16  7:29 ` [PATCH v2] " Tian Yuchen
2026-08-01 15:53   ` Tian Yuchen
2026-08-04  8:24   ` Patrick Steinhardt
2026-08-04 17:38     ` Junio C Hamano
2026-08-05 12:34       ` Tian Yuchen
2026-08-05 12:10     ` Tian Yuchen
2026-08-07  9:41   ` [PATCH v3] " Tian Yuchen
2026-08-07 17:03     ` Junio C Hamano
2026-08-09 15:00       ` Tian Yuchen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2310939d-014f-483b-8ad3-241871b770d5@malon.dev \
    --to=cat@malon.dev \
    --cc=ayu.chandekar@gmail.com \
    --cc=belkid98@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox