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

[PATCH v2 0/7] odb: introduce object storage extension

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 21, 2026, 05:39 UTC
Message-ID
<20261021-b4-pks-odb-extension-v2-0-8cf11b65eda8@pks.im>
In-Reply-To
<20261019-b4-pks-odb-extension-v1-0-143a5963b77f@pks.im>
Hi,

this patch series introduces the object storage extension. The extension is of course similar in spirit and design to the ref storage extension: it can be configured via "extensions.objectStorage", has the same syntax with "<schema>[://<payload>]", and we have the same mechanisms to configure it ("--object-storage-format=", GIT_OBJECT_STORAGE_FORMAT, GIT_DEFAULT_OBJECT_STORAGE_FORMAT, "init.defaultObjetcStorageFormat").

For now, we only support the "files" object storage format, so not a lot of stuff really changes. That being said, its optional payload allows you to configure a different location for the ".git/objects" directory. So if you specify "extensions.objectStorage=files://objs", objects would be stored in ".git/objs" instead.

The series is built on top of c51408889c (The 6th batch, 2026-10-16) with the following dependencies merged into it:

  - ps/odb-files-alternates at 0ba59c8453 (odb/source: drop
    `read_alternates` callback, 2026-10-08) merged into it.
  - ps/setup-enforce-repo-passed-to-create-repository-has-no-state
    (phew, what a mouthful) at 0ba59c8453 (odb/source: drop
    `read_alternates` callback, 2026-10-08).

Note that these two series conflict with one another. The conflict can easily be resolved by just deleting the whole conflicting sections.

Changes in v2:
  - Ensure that `repo->object_storage_format` is always populated.
  - Link to v1: https://patch.msgid.link/20261019-b4-pks-odb-extension-v1-0-143a5963b77f@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (7):
      loose: drop unused `repo_write_loose_object_map()`
      setup: introduce object storage extension
      setup: allow overriding object storage format via environment
      builtin: expose the object storage format
      builtin/init: introduce handling of object storage format
      builtin/clone: introduce "--object-storage-format="
      builtin/submodule: propagate "--object-storage-format="
 Documentation/config/extensions.adoc       |  23 +++
 Documentation/config/init.adoc             |   5 +
 Documentation/git-clone.adoc               |  11 ++
 Documentation/git-init.adoc                |  10 +-
 Documentation/git-repo.adoc                |   6 +
 Documentation/git-rev-parse.adoc           |   5 +
 Documentation/git-submodule.adoc           |  10 +-
 Documentation/git.adoc                     |  10 ++
 Documentation/object-storage-format.adoc   |   6 +
 builtin/clone.c                            |  58 +++++++-
 builtin/init-db.c                          |   7 +-
 builtin/repo.c                             |   8 ++
 builtin/rev-parse.c                        |   5 +
 builtin/submodule--helper.c                |  28 ++++
 environment.h                              |   1 +
 git-submodule.sh                           |  18 +++
 loose.c                                    |  46 ------
 loose.h                                    |   1 -
 odb.c                                      |   2 +-
 odb/source-files.c                         |   7 +
 odb/source-files.h                         |   1 +
 odb/source.c                               |  45 +++++-
 odb/source.h                               |  12 +-
 repository.c                               |  11 ++
 repository.h                               |   8 ++
 setup.c                                    | 116 ++++++++++++++-
 setup.h                                    |   2 +
 t/meson.build                              |   1 +
 t/t0001-init.sh                            | 221 +++++++++++++++++++++++++++++
 t/t1900-repo-info.sh                       |   3 +
 t/t5601-clone.sh                           |  68 +++++++++
 t/t7427-submodule-object-storage-format.sh |  91 ++++++++++++
 t/unit-tests/u-odb-inmemory.c              |   1 +
 33 files changed, 785 insertions(+), 62 deletions(-)
Range-diff versus v1:
1:  c9d303a0a4 = 1:  49f964eeec loose: drop unused `repo_write_loose_object_map()`
2:  1090634b33 ! 2:  82849d866a setup: introduce object storage extension
    @@ odb/source.c: const char *odb_source_type_to_name(enum odb_source_type type)
     +	struct odb_source *source;
     +	char *payload = NULL;
     +
    -+	if (!object_storage_format)
    -+		return &odb_source_files_new(odb, NULL, flags)->base;
    -+
     +	switch (odb_source_type_by_uri(object_storage_format, &payload)) {
     +	case ODB_SOURCE_FILES:
     +		source = &odb_source_files_new(odb, payload, flags)->base;
    @@ repository.c: void repo_set_ref_storage_format(struct repository *repo,
     +				    const char *uri)
     +{
     +	free(repo->object_storage_format);
    -+	repo->object_storage_format = xstrdup_or_null(uri);
    ++	if (uri)
    ++		repo->object_storage_format = xstrdup(uri);
    ++	else
    ++		repo->object_storage_format = xstrdup("files");
     +}
     +
      /*
    @@ t/t0001-init.sh: test_expect_success 'init with --ref-storage-format=garbage' '
      test_expect_success MINGW 'core.hidedotfiles = false' '
      	git config --global core.hidedotfiles false &&
      	rm -rf newdir &&
    +
    + ## t/unit-tests/u-odb-inmemory.c ##
    +@@
    + 
    + static struct repository repo = {
    + 	.hash_algo = &hash_algos[GIT_HASH_SHA1],
    ++	.object_storage_format = (char *) "files",
    + };
    + static struct object_database *odb;
    + 
3:  afbd06d834 = 3:  5d5728f5a3 setup: allow overriding object storage format via environment
4:  aba2dd3339 ! 4:  9b408ae68e builtin: expose the object storage format
    @@ builtin/repo.c: static int get_references_format(struct repository *repo, struct
      
     +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));
    ++	strbuf_addstr(buf, repo->object_storage_format);
     +	return 0;
     +}
     +
    @@ builtin/rev-parse.c: int cmd_rev_parse(int argc,
      				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));
    ++				puts(the_repository->object_storage_format);
     +				continue;
     +			}
      			if (!strcmp(arg, "--end-of-options")) {
5:  a61a7f674d ! 5:  ca8be36980 builtin/init: introduce handling of object storage format
    @@ setup.c: void initialize_repository_version(struct repository *repo,
      	    ref_storage_format != REF_STORAGE_FORMAT_FILES ||
     -	    repo->ref_storage_payload)
     +	    repo->ref_storage_payload ||
    -+	    repo->object_storage_format)
    ++	    strcmp(repo->object_storage_format, "files"))
      		target_version = GIT_REPO_VERSION_READ;
      
      	if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)
    @@ setup.c: void initialize_repository_version(struct repository *repo,
      		repo_config_set_gently(repo, "extensions.refstorage", NULL);
      	}
      
    -+	if (repo->object_storage_format)
    ++	if (strcmp(repo->object_storage_format, "files"))
     +		repo_config_set(repo, "extensions.objectstorage",
     +				repo->object_storage_format);
     +	else if (reinit)
6:  a61c708bc9 = 6:  34c9345892 builtin/clone: introduce "--object-storage-format="
7:  1d2c6a3cd0 = 7:  95c9be6418 builtin/submodule: propagate "--object-storage-format="

--- base-commit: 0d31382da9336683214372ba328fe9ecbc8bcb9a change-id: 20261006-b4-pks-odb-extension-36de693bb943

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 23 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.