From: Karthik Nayak Date: Mon, 26 Oct 2026 11:25:11 GMT Subject: Re: [PATCH v3 3/7] setup: allow overriding object storage format via environment Message-ID: In-Reply-To: <20261023-b4-pks-odb-extension-v3-3-b1bb30a006db@pks.im> Patrick Steinhardt writes: > The ref storage format configured via "extensions.refStorage" can be > overridden with the GIT_REF_STORAGE_FORMAT environment variable. > Introduce the GIT_OBJECT_STORAGE_FORMAT environment variable that > overrides "extensions.objectStorage" in the same way. [snip] > diff --git a/setup.c b/setup.c > index 249bd67876..70aa90a9cb 100644 > --- a/setup.c > +++ b/setup.c > @@ -2097,6 +2098,21 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok) > die(_("unknown ref storage format: '%s'"), ref_backend_uri); > } > > + /* > + * Likewise, the GIT_OBJECT_STORAGE_FORMAT environment Really nitpicking today: I would drop the 'Likewise' here as this binds this section of the code to the previous, which may not stay the same over time. > + * variable should override the repository config for > + * 'extensions.objectStorage'. > + */ > + object_storage_uri = getenv(GIT_OBJECT_STORAGE_FORMAT_ENVIRONMENT); > + if (object_storage_uri) { > + FREE_AND_NULL(discovery.format.object_storage_payload); > + discovery.format.object_storage_format = > + object_storage_format_by_uri(object_storage_uri, > + &discovery.format.object_storage_payload); > + if (discovery.format.object_storage_format == OBJECT_STORAGE_FORMAT_UNKNOWN) > + die(_("unknown object storage format: '%s'"), object_storage_uri); > + } > + > if (apply_repository_format(repo, &discovery.format, > APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0) > die("%s", err.buf); [snip]