Re: [PATCH 4/7] builtin: expose the object storage format
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 19, 2026, 21:40 UTC
- Message-ID
- <CAOLa=ZQ1E5sg05++KCXgbM9+=4=vFeCHU-5iMbNEGRuS-8+aPg@mail.gmail.com>
- In-Reply-To
- <20261019-b4-pks-odb-extension-v1-4-143a5963b77f@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> The ref storage format of a repository can be inspected via both > git-rev-parse(1)'s "--show-ref-storage-format" and git-repo(1)'s > "references.storageFormat" field. Introduce the equivalent options for > the object storage format, as well.
[snip]
Show 12 quoted lines
> diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc > index cb8c1e7292..d2dc9b7a69 100644 > --- a/Documentation/git-repo.adoc > +++ b/Documentation/git-repo.adoc > @@ -105,6 +105,12 @@ values that they return: > `object.format`:: > The object format (hash algorithm) used in the repository. > > +`objects.storageFormat`:: > + The object storage format used in the repository, as configured via > + `extensions.objectStorage`. The valid values are: > ++
The nuance between `object` above and `objects` here is too little and can be confusing. But there's nothing we can really do here.
[snip]
Show 15 quoted lines
> diff --git a/builtin/repo.c b/builtin/repo.c
> index 84e012f83f..da11a56ede 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -128,11 +129,20 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
> return 0;
> }
>
> +static int get_object_storage_format(struct repository *repo, struct strbuf *buf)
> +{
> + strbuf_addstr(buf, repo->object_storage_format ?
> + repo->object_storage_format :
> + odb_source_type_to_name(ODB_SOURCE_FILES));
> + return 0;
> +}Is there a reason why `repo->object_storage_format` won't be set, I don't like the fact that we have to expose the default object storage format outside the repository and odb subsystem.
Show 10 quoted lines
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index ec33c19bdf..b206944ad9 100644
> @@ -1138,6 +1139,12 @@ int cmd_rev_parse(int argc,
> puts(ref_storage_format_to_name(the_repository->ref_storage_format));
> continue;
> }
> + if (!strcmp(arg, "--show-object-storage-format")) {
> + puts(the_repository->object_storage_format ?
> + the_repository->object_storage_format :
> + odb_source_type_to_name(ODB_SOURCE_FILES));Same question here.
Show 5 quoted lines
> + continue;
> + }
> if (!strcmp(arg, "--end-of-options")) {
> seen_end_of_options = 1;
> if (filter & (DO_FLAGS | DO_REVS))[snip]