From: Junio C Hamano <gitster@pobox.com>
To: "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Jeff King <peff@peff.net>,
Kristofer Karlsson <krka@spotify.com>
Subject: Re: [PATCH] odb: do not list our own refs as alternate refs in the quarantine
Date: Thu, 29 Oct 2026 10:24:54 -0700 [thread overview]
Message-ID: <xmqqfqxo4dy1.fsf@gitster.g> (raw)
In-Reply-To: <pull.2285.git.1793200705017.gitgitgadget@gmail.com> (Kristofer Karlsson via GitGitGadget's message of "Wed, 28 Oct 2026 15:18:24 +0000")
"Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> I also tried resolving the object directories that --alternate-refs uses
> before the quarantine is created. That got a bit messy: it needed a new
> internal rev-list option, and receive-pack had to carry the list of
> directories through to each of its connectivity checks. And it only
> fixes the check itself; other processes running inside the quarantine,
> like pre-receive hooks, would still see the repository as its own
> alternate.
>
> So the question is really where this should be fixed: is there a better
> way for processes running inside the quarantine to tell the repository's
> own object directory apart from real alternates?
> @@ -190,6 +191,20 @@ static int refs_from_alternate_cb(struct odb_files_dir *alternate,
> goto out;
> if (!strbuf_strip_suffix(&path, "/objects"))
> goto out;
> +
> + /*
> + * NEEDSWORK: this is a hack, mainly here to measure the cost of
> + * the bug. Inside an object quarantine, tmp-objdir passes our own
> + * object directory to child processes as an alternate, so we would
> + * list our own refs as alternate refs, including the hidden refs
> + * that the connectivity check of receive-pack deliberately skips.
> + * Comparing paths papers over that; the quarantine should rather
> + * tell its children which directory is ours.
> + */
In other words, if we tell our quarantine child where our real
object directory is, say, via the 'GIT_QUARANTINE_OBJECT_DIRECTORY'
environment variable, can the child notice the variable and identify
which of the passed alternates is the real object directory, so that
it knows not to use the refs associated with it?
It is a bit of a shame that tmp_objdir_create() exports the same
value as DB_ENVIRONMENT in GIT_QUARANTINE_ENVIRONMENT, as the only
existing use of the latter is to check if the variable is exported
or not---in other words, to carry a single bit of information ("are
we in quarantine or not"). I wonder if we can change its value to
name the parent process's real object directory instead? Then we
would not need to export yet another variable to carry the
information we need.
prev parent reply other threads:[~2026-10-29 17:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 15:18 [PATCH] odb: do not list our own refs as alternate refs in the quarantine Kristofer Karlsson via GitGitGadget
2026-10-29 16:57 ` Justin Tobler
2026-10-29 17:24 ` Junio C Hamano [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=xmqqfqxo4dy1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=krka@spotify.com \
--cc=peff@peff.net \
--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