From: Patrick Steinhardt <ps@pks.im>
To: Justin Tobler <jltobler@gmail.com>
Cc: git@vger.kernel.org, Karthik Nayak <karthik.188@gmail.com>,
Jeff King <peff@peff.net>
Subject: Re: [PATCH v2 7/8] refs: fix recursing `get_main_ref_store()` with "onbranch" config
Date: Thu, 18 Jun 2026 16:51:03 +0200 [thread overview]
Message-ID: <ajQF1yyCUOdzC4Jq@pks.im> (raw)
In-Reply-To: <ajP7W7KsXz4Wk262@denethor>
On Thu, Jun 18, 2026 at 09:15:00AM -0500, Justin Tobler wrote:
> On 26/06/18 07:59AM, Patrick Steinhardt wrote:
> > On Wed, Jun 17, 2026 at 01:41:40PM -0500, Justin Tobler wrote:
> > > Is this really the best signal to indicate that a repository ref store
> > > has not been initialized? Temporarily setting the storage format to
> > > REF_STORAGE_FORMAT_UNKNOWN feels rather awkward and suggests to me that
> > > `include_by_branch()` probably shouldn't be using it to begin with if
> > > its not reliable.
> >
> > True, but we don't really have a better signal to the best of my
> > knowledge. Ideally, we'd be able to use the existence `r->refs_private`
> > as signal. But that doesn't really work as the reference database is
> > lazily constructed, and the recursion happens in the exact function that
> > would construct it in the first place. And there indeed are cases where
> > reading the configuration is the first caller of `get_main_ref_store()`.
>
> Ok, my first thought was also whether we could use the existence of the
> ref store as a signal, but I guess that won't work here.
>
> > My first internal iteration tried to make this non-lazily constructed so
> > that we can use it as a proper signal. But that led to a bunch of
> > problems where we now parsed configuration way earlier than we currently
> > do, and that in turn led to all kinds of errors. I was able to fix all
> > of those errors except one: we expect `git config set` to work in a
> > misconfigured repository so that the user can fix the misconfig without
> > having to manually edit the Git configuration files. But when
> > constructing the refdb eagerly we will die early in such cases.
> >
> > We could again work around that issue, but that unfortunately evolved
> > into a proper mess that I eventually discarded as unworkable. I think
> > this is an inherent design flaw: constructing the refdb requires us to
> > be able to parse the configuration, but constructing the configuration
> > may require us to construct the refdb. So this awkwardness is built into
> > Git's design, unfortunately.
> >
> > So I'd really love to have a better signal, as I fully agree that the
> > above workaround is nothing more but a hack. But I'm just not sure what
> > that signal would be. And this version here does exactly what we want:
> > we honor "onbranch" conditionals in all cases, except when constructing
> > the main reference store. Even if it's ugly.
>
> Could we embed an `initialized` boolean in `struct ref_store` that gets
> set when the ref store is properly initialized and use that as a signal
> instead? I'm not sure how complex introducing this would be though.
We could, but I'm not sure what that would really buy us. It would
basically be one more bit of state that we have to track going forward,
and thus one more source of inconsistencies.
Patrick
next prev parent reply other threads:[~2026-06-18 14:51 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 14:57 [PATCH 0/9] refs: stop using `chdir_notify_reparent()` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 1/9] setup: inline `check_and_apply_repository_format()` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 2/9] setup: stop applying repository format twice Patrick Steinhardt
2026-06-12 9:00 ` Karthik Nayak
2026-06-15 12:36 ` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 3/9] setup: don't apply "GIT_REFERENCE_BACKEND" without a repository Patrick Steinhardt
2026-06-10 17:32 ` Junio C Hamano
2026-06-12 6:18 ` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 4/9] refs: unregister reference stores from "chdir_notify" Patrick Steinhardt
2026-06-12 9:18 ` Karthik Nayak
2026-06-15 12:36 ` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 5/9] chdir-notify: drop unused `chdir_notify_reparent()` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 6/9] repository: free main reference database Patrick Steinhardt
2026-06-12 9:20 ` Karthik Nayak
2026-06-10 14:57 ` [PATCH 7/9] refs: fix recursing `get_main_ref_store()` with "onbranch" config Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 8/9] refs: drop local buffer in `refs_compute_filesystem_location()` Patrick Steinhardt
2026-06-10 14:57 ` [PATCH 9/9] refs: always use absolute paths for reference stores Patrick Steinhardt
2026-06-12 9:58 ` Karthik Nayak
2026-06-15 12:36 ` Patrick Steinhardt
2026-06-11 6:53 ` [PATCH 0/9] refs: stop using `chdir_notify_reparent()` Jeff King
2026-06-12 6:18 ` Patrick Steinhardt
2026-06-13 14:00 ` Jeff King
2026-06-15 12:36 ` Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 0/8] " Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 1/8] setup: inline `check_and_apply_repository_format()` Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 2/8] setup: stop applying repository format twice Patrick Steinhardt
2026-06-17 17:22 ` Justin Tobler
2026-06-15 13:56 ` [PATCH v2 3/8] setup: don't apply "GIT_REFERENCE_BACKEND" without a repository Patrick Steinhardt
2026-06-17 17:43 ` Justin Tobler
2026-06-18 6:53 ` Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 4/8] refs: unregister reference stores from "chdir_notify" Patrick Steinhardt
2026-06-17 18:02 ` Justin Tobler
2026-06-17 18:07 ` Justin Tobler
2026-06-18 6:54 ` Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 5/8] chdir-notify: drop unused `chdir_notify_reparent()` Patrick Steinhardt
2026-06-15 13:56 ` [PATCH v2 6/8] repository: free main reference database Patrick Steinhardt
2026-06-17 18:09 ` Justin Tobler
2026-06-15 13:56 ` [PATCH v2 7/8] refs: fix recursing `get_main_ref_store()` with "onbranch" config Patrick Steinhardt
2026-06-17 18:41 ` Justin Tobler
2026-06-18 5:59 ` Patrick Steinhardt
2026-06-18 14:15 ` Justin Tobler
2026-06-18 14:51 ` Patrick Steinhardt [this message]
2026-06-18 15:53 ` Justin Tobler
2026-06-18 16:40 ` Jeff King
2026-06-15 13:56 ` [PATCH v2 8/8] refs: drop local buffer in `refs_compute_filesystem_location()` Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 0/8] refs: stop using `chdir_notify_reparent()` Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 1/8] setup: inline `check_and_apply_repository_format()` Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 2/8] setup: stop applying repository format twice Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 3/8] setup: don't apply "GIT_REFERENCE_BACKEND" without a repository Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 4/8] refs: unregister reference stores from "chdir_notify" Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 5/8] chdir-notify: drop unused `chdir_notify_reparent()` Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 6/8] repository: free main reference database Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 7/8] refs: fix recursing `get_main_ref_store()` with "onbranch" config Patrick Steinhardt
2026-06-18 6:54 ` [PATCH v3 8/8] refs: drop local buffer in `refs_compute_filesystem_location()` Patrick Steinhardt
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=ajQF1yyCUOdzC4Jq@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=peff@peff.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.