Re: [PATCH] odb: do not list our own refs as alternate refs in the quarantine
- From
Kristofer Karlsson <krka@spotify.com>
- Date
- Oct 30, 2026, 11:51 UTC
- Message-ID
- <CAL71e4PXZ8-T3RgLQQLtL2ASQMLbRrChfV6wAqxFSd_Tw7-2Sg@mail.gmail.com>
- In-Reply-To
- <xmqqfqxo4dy1.fsf@gitster.g>
On Thu, 29 Oct 2026 at 18:24, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
>
> 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.Agreed, I think that is a reasonable way forward to a concrete fix.
I started working on a v2 based on your suggestion there. First I tried tweaking GIT_QUARANTINE_PATH to point to the real object dir, but I realized that might be unsafe since some hooks may depend on the semantics of that env variable, so it would be a breaking change.
Then I started adding a second env variable. That worked and it was not _too_ messy though I realized it was a bit redundant. We can simply deduce the real object directory from the quarantine directory -- it's the parent, based on how tmp_objdir_create() works today -- so I built my preliminary v2 on that.
It feels like a slightly icky assumption to make, but it feels safe since I added tests to cover it, and does not seem possible to override outside of git itself.
That said, if you think this is over-simplifying it, I can pivot back to introducing a new environment variable instead.
Thanks! Kristofer