Re: [PATCH v3 3/7] setup: allow overriding object storage format via environment
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 26, 2026, 11:25 UTC
- Message-ID
- <CAOLa=ZTrYBtLOPMh04-J8AkH0797aeKsnXB61H-V8vb1x0r2Jg@mail.gmail.com>
- In-Reply-To
- <20261023-b4-pks-odb-extension-v3-3-b1bb30a006db@pks.im>
Patrick Steinhardt <ps@pks.im> 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]
Show 10 quoted lines
> 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 environmentReally 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.
Show 16 quoted lines
> + * 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]