git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/7] setup: introduce object storage extension

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 20, 2026, 08:50 UTC
Message-ID
<atcrO3y0o-2G8Dpu@pks.im>
In-Reply-To
<CAOLa=ZQj0sZu7WRzmvgZx23ZeO1KBtOm6yWOLCzeVP_86zkTPQ@mail.gmail.com>
On Mon, Oct 19, 2026 at 02:29:20PM -0700, Karthik Nayak wrote:
Show 18 quoted lines
> 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.

Show 12 quoted lines
> > 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.

Show 22 quoted lines
> > 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.
Show 12 quoted lines
> > +	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
Previous: Karthik NayakNext: Karthik Nayak
Message 10 of 59 in “odb: introduce object storage extension”
  1. 0/7 odb: introduce object storage extensionPatrick Steinhardt, Oct 19, 2026
  2. 1/7 loose: drop unused `repo_write_loose_object_map()`Patrick Steinhardt, Oct 19, 2026
  3. Karthik NayakOct 19, 2026
  4. Patrick SteinhardtOct 20, 2026
  5. Karthik NayakOct 20, 2026
  6. 2/7 setup: introduce object storage extensionPatrick Steinhardt, Oct 19, 2026
  7. Karthik NayakOct 19, 2026
  8. Junio C HamanoOct 20, 2026
  9. Karthik NayakOct 20, 2026
  10. Patrick SteinhardtOct 20, 2026
  11. Karthik NayakOct 20, 2026
  12. 3/7 setup: allow overriding object storage format via environmentPatrick Steinhardt, Oct 19, 2026
  13. Karthik NayakOct 19, 2026
  14. Patrick SteinhardtOct 20, 2026
  15. Karthik NayakOct 20, 2026
  16. 4/7 builtin: expose the object storage formatPatrick Steinhardt, Oct 19, 2026
  17. Karthik NayakOct 19, 2026
  18. Patrick SteinhardtOct 20, 2026
  19. Karthik NayakOct 20, 2026
  20. 5/7 builtin/init: introduce handling of object storage formatPatrick Steinhardt, Oct 19, 2026
  21. 6/7 builtin/clone: introduce "--object-storage-format="Patrick Steinhardt, Oct 19, 2026
  22. 7/7 builtin/submodule: propagate "--object-storage-format="Patrick Steinhardt, Oct 19, 2026
  23. 0/7 odb: introduce object storage extensionPatrick Steinhardt, Oct 21, 2026
  24. 1/7 loose: drop unused `repo_write_loose_object_map()`Patrick Steinhardt, Oct 21, 2026
  25. 2/7 setup: introduce object storage extensionPatrick Steinhardt, Oct 21, 2026
  26. 3/7 setup: allow overriding object storage format via environmentPatrick Steinhardt, Oct 21, 2026
  27. 4/7 builtin: expose the object storage formatPatrick Steinhardt, Oct 21, 2026
  28. 5/7 builtin/init: introduce handling of object storage formatPatrick Steinhardt, Oct 21, 2026
  29. Karthik NayakOct 21, 2026
  30. Patrick SteinhardtOct 23, 2026
  31. 6/7 builtin/clone: introduce "--object-storage-format="Patrick Steinhardt, Oct 21, 2026
  32. 7/7 builtin/submodule: propagate "--object-storage-format="Patrick Steinhardt, Oct 21, 2026
  33. Karthik NayakOct 21, 2026
  34. 0/7 odb: introduce object storage extensionPatrick Steinhardt, Oct 23, 2026
  35. 1/7 loose: drop unused `repo_write_loose_object_map()`Patrick Steinhardt, Oct 23, 2026
  36. 2/7 setup: introduce object storage extensionPatrick Steinhardt, Oct 23, 2026
  37. SZEDER GáborOct 24, 2026
  38. Patrick SteinhardtOct 26, 2026
  39. Karthik NayakOct 26, 2026
  40. Patrick SteinhardtOct 26, 2026
  41. 3/7 setup: allow overriding object storage format via environmentPatrick Steinhardt, Oct 23, 2026
  42. Karthik NayakOct 26, 2026
  43. Patrick SteinhardtOct 26, 2026
  44. 4/7 builtin: expose the object storage formatPatrick Steinhardt, Oct 23, 2026
  45. 5/7 builtin/init: introduce handling of object storage formatPatrick Steinhardt, Oct 23, 2026
  46. 6/7 builtin/clone: introduce "--object-storage-format="Patrick Steinhardt, Oct 23, 2026
  47. 7/7 builtin/submodule: propagate "--object-storage-format="Patrick Steinhardt, Oct 23, 2026
  48. Karthik NayakOct 26, 2026
  49. Patrick SteinhardtOct 26, 2026
  50. 0/7 odb: introduce object storage extensionPatrick Steinhardt, Oct 27, 2026
  51. 1/7 loose: drop unused `repo_write_loose_object_map()`Patrick Steinhardt, Oct 27, 2026
  52. 2/7 setup: introduce object storage extensionPatrick Steinhardt, Oct 27, 2026
  53. 3/7 setup: allow overriding object storage format via environmentPatrick Steinhardt, Oct 27, 2026
  54. 4/7 builtin: expose the object storage formatPatrick Steinhardt, Oct 27, 2026
  55. 5/7 builtin/init: introduce handling of object storage formatPatrick Steinhardt, Oct 27, 2026
  56. 6/7 builtin/clone: introduce "--object-storage-format="Patrick Steinhardt, Oct 27, 2026
  57. 7/7 builtin/submodule: propagate "--object-storage-format="Patrick Steinhardt, Oct 27, 2026
  58. Karthik NayakOct 28, 2026
  59. Patrick SteinhardtOct 28, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.