From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/7] setup: introduce object storage extension
Date: Tue, 20 Oct 2026 10:50:03 +0200 [thread overview]
Message-ID: <atcrO3y0o-2G8Dpu@pks.im> (raw)
In-Reply-To: <CAOLa=ZQj0sZu7WRzmvgZx23ZeO1KBtOm6yWOLCzeVP_86zkTPQ@mail.gmail.com>
On Mon, Oct 19, 2026 at 02:29:20PM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/odb/source-files.c b/odb/source-files.c
> > index 455f409db0..4a7cbbfd9b 100644
> > --- a/odb/source-files.c
> > +++ b/odb/source-files.c
> > @@ -1245,6 +1246,12 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
> > object_dir = xstrdup_or_null(getenv(DB_ENVIRONMENT));
> > alternates = xstrdup_or_null(getenv(ALTERNATE_DB_ENVIRONMENT));
> > }
> > + if (!object_dir && payload) {
> > + if (is_absolute_path(payload))
> > + object_dir = xstrdup(payload);
> > + else
> > + object_dir = xstrfmt("%s/%s", odb->repo->commondir, payload);
> > + }
>
> On the reference side, we use `strbuf_realpath()` to convert the
> relative paths to absolute paths, should we be doing that here too?
Overall I'd love for the "files" source to only ever use absolute paths,
but historically that wasn't the case. We sometimes expose those paths
to users, and changing the "files" source thus breaks a bunch of tests.
So I'm retaining that behaviour for now, also with the extension. It may
be something to explore going forward though.
> > diff --git a/odb/source.c b/odb/source.c
> > index b25ef14df8..10abe33a26 100644
> > --- a/odb/source.c
> > +++ b/odb/source.c
> > @@ -1,4 +1,5 @@
> > #include "git-compat-util.h"
> > +#include "gettext.h"
> > #include "object-file.h"
> > #include "odb/source-files.h"
> > #include "odb/source.h"
>
> Do we need this import? This commit seems to compile without it.
Yeah, we add some translatable strings to `odb_source_new()`. The header
is also implicitly included, but as Junio pointed out we should include
headers explicitly regardless when we require their declarations.
> > diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> > index f1d227f271..c7c464d3a2 100755
> > --- a/t/t0001-init.sh
> > +++ b/t/t0001-init.sh
> > @@ -839,6 +839,36 @@ test_expect_success 'init with --ref-storage-format=garbage' '
> > test_cmp expect err
> > '
> >
> > +test_expect_success DEFAULT_REPO_FORMAT 'extensions.objectStorage is not allowed with repo version 0' '
> > + test_when_finished "rm -rf objstorage" &&
> > + git init objstorage &&
> > + git -C objstorage config set extensions.objectStorage files &&
> > + test_must_fail git -C objstorage rev-parse 2>err &&
> > + test_grep "repo version is 0, but v1-only extension found" err
> > +'
> > +
> > +test_expect_success DEFAULT_REPO_FORMAT 'extensions.objectStorage with files backend' '
> > + test_when_finished "rm -rf objstorage" &&
> > + git init objstorage &&
> > + git -C objstorage config set core.repositoryformatversion 1 &&
>
> If we're doing this, do we still need DEFAULT_REPO_FORMAT?
We could indeed get away with not having the prerequisite right now. But
once we have a second backend we'd need this, because in that case we'd
potentially initialize the repository with a different backend here. And
then just switching over to the "files" backend would probably not
result in anything good.
So this is more of a protective measure for the future.
> > + git -C objstorage config set extensions.objectStorage garbage &&
> > + test_must_fail git -C objstorage rev-parse 2>err &&
> > + test_grep "invalid value for ${SQ}extensions.objectstorage${SQ}: ${SQ}garbage${SQ}" err &&
> > +
> > + git config --file objstorage/.git/config extensions.objectStorage garbage://payload &&
> > + test_must_fail git -C objstorage rev-parse 2>err &&
> > + test_grep "invalid value for ${SQ}extensions.objectstorage${SQ}: ${SQ}garbage://payload${SQ}" err
> > +'
> > +
>
> We should add tests for the files ODB with {valid, invalid} payload. We
> should probably also test absolute and relative paths in the valid flow.
I add tests for both absolute and relative paths in a later commit. Here
I'm basically just verifying whether the object storage extension even
kicks in at all, without yet verifying its semantics properly.
Patrick
next prev parent reply other threads:[~2026-10-20 8:50 UTC|newest]
Thread overview: 17+ 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-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 8:50 ` Patrick Steinhardt [this message]
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-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-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
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=atcrO3y0o-2G8Dpu@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 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.