From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org,
"brian m . carlson" <sandals@crustytoothpaste.net>,
Patrick Steinhardt <ps@pks.im>,
Karthik Nayak <karthik.188@gmail.com>,
Jeff King <peff@peff.net>, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2 1/5] promisor-remote: factor out lazy_fetch_objects()
Date: Fri, 14 Aug 2026 10:49:41 -0700 [thread overview]
Message-ID: <xmqqjypsoami.fsf@gitster.g> (raw)
In-Reply-To: <20260813154748.2378747-2-christian.couder@gmail.com> (Christian Couder's message of "Thu, 13 Aug 2026 17:47:44 +0200")
Christian Couder <christian.couder@gmail.com> writes:
> +/*
> + * Return 'true' if all the objects could be fetched, 'false' otherwise.
> + */
> +static bool lazy_fetch_objects(struct repository *repo,
> + struct object_id **remaining_oids,
> + int *remaining_nr,
> + int *to_free)
> +{
> + if (git_env_bool(NO_LAZY_FETCH_ENVIRONMENT, 0)) {
> + static int warning_shown;
> + if (!warning_shown) {
> + warning_shown = 1;
> + warning(_("lazy fetching disabled; some objects may not be available"));
> + }
> + return false;
> + }
> +
> + promisor_remote_init(repo);
> +
> + /* Try accepted remotes first (those the server told us to use) */
> + if (try_promisor_remotes(repo, remaining_oids, remaining_nr,
> + to_free, true))
> + return true;
> +
> + return try_promisor_remotes(repo, remaining_oids, remaining_nr,
> + to_free, false);
> }
Perhaps writing it this way would make it easier to tell what is
going on. We try the preferred ones first, and then fall back to
the other ones.
return (try_promisor_remotes(..., true) ||
try_promisor_remotes(..., false));
But more importantly, I wonder if keeping the list of missing object
names in memory will later turn out to be problematic in real-life
applications. Without knowing much about how the current code for
bulk dehydrating promisor objects is structured, I expected an API
that looks more like:
- bulk_download_begin(): performs the early part of
fetch_objects(), sets up connections to the promisor remote(s),
and calls start_command() on the child process.
- bulk_download_this(): after calling the _begin() function above,
it runs around and collects missing objects that it needs to do
its work. For each such missing object it discovers, this
function is called, which sends the object name down the
'--stdin' file descriptor.
- bulk_download_done(): tells the child process that we are done
feeding object names.
but that is not what I am seeing. I guess the current arrangement
cannot be avoided, because we are going to fetch from more than one
promisor remote. Under such constraints, the way to deal with a
massive number of missing objects will not be "streaming" like I
imagined above, but needs to be done differently, like spooling to a
file or something silly like that.
In any case, except that this avoids checking the environment
variable multiple times, I can see that it is a no-op refactoring of
the existing code.
Nice and cleanly done.
Thanks.
next prev parent reply other threads:[~2026-08-14 17:49 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 8:51 [PATCH 0/3] Introduce a 'fromAccepted' option to GIT_NO_LAZY_FETCH Christian Couder
2026-07-10 8:51 ` [PATCH 1/3] promisor-remote: factor out lazy_fetch_objects() Christian Couder
2026-07-10 8:51 ` [PATCH 2/3] promisor-remote: introduce enum allow_lazy_fetch Christian Couder
2026-07-10 8:51 ` [PATCH 3/3] promisor-remote: teach 'fromAccepted' to GIT_NO_LAZY_FETCH Christian Couder
2026-07-10 19:50 ` [PATCH 0/3] Introduce a 'fromAccepted' option " brian m. carlson
2026-07-12 9:06 ` Christian Couder
2026-08-07 13:55 ` [PATCH 0/5] Introduce 'uploadpack.lazyFetchTrusted' Christian Couder
2026-08-07 13:55 ` [PATCH 1/5] promisor-remote: factor out lazy_fetch_objects() Christian Couder
2026-08-07 13:58 ` Christian Couder
2026-08-07 13:55 ` [PATCH 2/5] setup: extract path_allowlist_apply() Christian Couder
2026-08-07 13:55 ` [PATCH 3/5] setup: add 'allow_dot' arg to path_allowlist_apply() Christian Couder
2026-08-07 13:55 ` [PATCH 4/5] upload-pack: read uploadpack.lazyFetchTrusted Christian Couder
2026-08-07 13:55 ` [PATCH 5/5] builtin/upload-pack: set GIT_NO_LAZY_FETCH to 0 on trusted repo Christian Couder
2026-08-07 18:31 ` [PATCH 0/5] Introduce 'uploadpack.lazyFetchTrusted' Junio C Hamano
2026-08-10 8:06 ` Christian Couder
2026-08-11 5:55 ` Junio C Hamano
2026-08-13 15:47 ` [PATCH v2 " Christian Couder
2026-08-13 20:31 ` Junio C Hamano
2026-08-14 16:31 ` Christian Couder
2026-08-14 16:40 ` Junio C Hamano
2026-08-13 15:47 ` [PATCH v2 1/5] promisor-remote: factor out lazy_fetch_objects() Christian Couder
2026-08-14 17:49 ` Junio C Hamano [this message]
2026-08-13 15:47 ` [PATCH v2 2/5] setup: extract path_allowlist_apply() Christian Couder
2026-08-14 17:56 ` Junio C Hamano
2026-08-13 15:47 ` [PATCH v2 3/5] setup: add 'allow_dot' arg to path_allowlist_apply() Christian Couder
2026-08-14 18:12 ` Junio C Hamano
2026-08-13 15:47 ` [PATCH v2 4/5] upload-pack: read uploadpack.lazyFetchTrusted Christian Couder
2026-08-14 18:56 ` Junio C Hamano
2026-08-13 15:47 ` [PATCH v2 5/5] builtin/upload-pack: set GIT_NO_LAZY_FETCH to 0 on trusted repo Christian Couder
2026-08-14 19:35 ` Junio C Hamano
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=xmqqjypsoami.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.