From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 5/7] builtin/init: introduce handling of object storage format
Date: Fri, 23 Oct 2026 07:33:15 +0200 [thread overview]
Message-ID: <atrxjqESUSunxsqU@pks.im> (raw)
In-Reply-To: <CAOLa=ZRzu_7No085hEHnULo0L50y=ntx3MSkb-VbcywChdOPZA@mail.gmail.com>
On Wed, Oct 21, 2026 at 10:23:17AM -0400, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/setup.c b/setup.c
> > index 98140a7641..3d74f8eeed 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -2466,7 +2466,8 @@ void initialize_repository_version(struct repository *repo,
> > */
> > if (hash_algo != GIT_HASH_SHA1_LEGACY ||
> > ref_storage_format != REF_STORAGE_FORMAT_FILES ||
> > - repo->ref_storage_payload)
> > + repo->ref_storage_payload ||
> > + strcmp(repo->object_storage_format, "files"))
> > target_version = GIT_REPO_VERSION_READ;
> >
>
> Okay so this is what also sets the 'core.repositoryformatversion'
> config. I was specifically looking for that.
>
> Does this mean that even for the files odb with a payload we need v1 of
> 'core.repositoryformatversion'?
Yes. Repository extensions aren't read in the case where we have a v0
repository, so we cannot make use of any non-default object storage
format there.
> > @@ -2490,6 +2491,12 @@ void initialize_repository_version(struct repository *repo,
> > repo_config_set_gently(repo, "extensions.refstorage", NULL);
> > }
> >
> > + if (strcmp(repo->object_storage_format, "files"))
> > + repo_config_set(repo, "extensions.objectstorage",
> > + repo->object_storage_format);
> > + else if (reinit)
> > + repo_config_set_gently(repo, "extensions.objectstorage", NULL);
> > +
>
> So this handled reinitializing the same repo. If there was a previously
> set object storage format, we unset it gently.
>
> But, we already catch and error out if the extension before and after
> reinit differ, so this `else` block is not needed, no? Removing it
> passes all the tests in this patch.
This is a slightly different case: if you have a repository that uses
the default storage format, but that explicitly configures the "files"
format, then we downgrade the repository format version to 0 and unset
the extension again. This logic basically matches what we do with the
ref backend, too.
I noticed there's no test for this though. And that then led me down the
rabbit hole, because I'm not particularly happy with some of the logic
here. For example, I was doing normalization of "files" vs "files://"
somewhat inconsistently.
So I've redone some of the infrastructure here to be much closer to what
we do with the ref backend. Currently we track the object storage format
as a single URI that we pass around, whereas for the ref storage format
we pass around a backend type and payload. And that makes normalization
a lot easier, and we don't have to re-parse the URI in a lot of places.
So I've adapted the series now to use the same approach. It also makes
stuff easier to reason about, as we basically have the exact same logic
for both storage types in most places.
I'll send that later today.
Patrick
next prev parent reply other threads:[~2026-10-23 5:33 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 8:55 [PATCH 0/7] odb: introduce object storage extension Patrick Steinhardt
2026-10-19 8:55 ` [PATCH 1/7] loose: drop unused `repo_write_loose_object_map()` Patrick Steinhardt
2026-10-19 20:21 ` Karthik Nayak
2026-10-20 8:49 ` Patrick Steinhardt
2026-10-20 18:30 ` Karthik Nayak
2026-10-19 8:55 ` [PATCH 2/7] setup: introduce object storage extension Patrick Steinhardt
2026-10-19 21:29 ` Karthik Nayak
2026-10-20 1:27 ` Junio C Hamano
2026-10-20 18:32 ` Karthik Nayak
2026-10-20 8:50 ` Patrick Steinhardt
2026-10-20 19:06 ` Karthik Nayak
2026-10-19 8:55 ` [PATCH 3/7] setup: allow overriding object storage format via environment Patrick Steinhardt
2026-10-19 21:34 ` Karthik Nayak
2026-10-20 8:50 ` Patrick Steinhardt
2026-10-20 19:08 ` Karthik Nayak
2026-10-19 8:55 ` [PATCH 4/7] builtin: expose the object storage format Patrick Steinhardt
2026-10-19 21:40 ` Karthik Nayak
2026-10-20 8:50 ` Patrick Steinhardt
2026-10-20 19:10 ` Karthik Nayak
2026-10-19 8:56 ` [PATCH 5/7] builtin/init: introduce handling of " Patrick Steinhardt
2026-10-19 8:56 ` [PATCH 6/7] builtin/clone: introduce "--object-storage-format=" Patrick Steinhardt
2026-10-19 8:56 ` [PATCH 7/7] builtin/submodule: propagate "--object-storage-format=" Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 0/7] odb: introduce object storage extension Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 1/7] loose: drop unused `repo_write_loose_object_map()` Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 2/7] setup: introduce object storage extension Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 3/7] setup: allow overriding object storage format via environment Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 4/7] builtin: expose the object storage format Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 5/7] builtin/init: introduce handling of " Patrick Steinhardt
2026-10-21 14:23 ` Karthik Nayak
2026-10-23 5:33 ` Patrick Steinhardt [this message]
2026-10-21 5:39 ` [PATCH v2 6/7] builtin/clone: introduce "--object-storage-format=" Patrick Steinhardt
2026-10-21 5:39 ` [PATCH v2 7/7] builtin/submodule: propagate "--object-storage-format=" Patrick Steinhardt
2026-10-21 14:31 ` [PATCH v2 0/7] odb: introduce object storage extension Karthik Nayak
2026-10-23 11:49 ` [PATCH v3 " Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 1/7] loose: drop unused `repo_write_loose_object_map()` Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 2/7] setup: introduce object storage extension Patrick Steinhardt
2026-10-24 14:50 ` SZEDER Gábor
2026-10-26 10:05 ` Patrick Steinhardt
2026-10-26 11:22 ` Karthik Nayak
2026-10-26 11:53 ` Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 3/7] setup: allow overriding object storage format via environment Patrick Steinhardt
2026-10-26 11:25 ` Karthik Nayak
2026-10-26 11:53 ` Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 4/7] builtin: expose the object storage format Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 5/7] builtin/init: introduce handling of " Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 6/7] builtin/clone: introduce "--object-storage-format=" Patrick Steinhardt
2026-10-23 11:49 ` [PATCH v3 7/7] builtin/submodule: propagate "--object-storage-format=" Patrick Steinhardt
2026-10-26 11:35 ` [PATCH v3 0/7] odb: introduce object storage extension Karthik Nayak
2026-10-26 11:53 ` Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 " Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 1/7] loose: drop unused `repo_write_loose_object_map()` Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 2/7] setup: introduce object storage extension Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 3/7] setup: allow overriding object storage format via environment Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 4/7] builtin: expose the object storage format Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 5/7] builtin/init: introduce handling of " Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 6/7] builtin/clone: introduce "--object-storage-format=" Patrick Steinhardt
2026-10-27 6:59 ` [PATCH v4 7/7] builtin/submodule: propagate "--object-storage-format=" 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=atrxjqESUSunxsqU@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
/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