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

Re: [PATCH v2 5/7] builtin/init: introduce handling of object storage format

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 21, 2026, 14:23 UTC
Message-ID
<CAOLa=ZRzu_7No085hEHnULo0L50y=ntx3MSkb-VbcywChdOPZA@mail.gmail.com>
In-Reply-To
<20261021-b4-pks-odb-extension-v2-5-8cf11b65eda8@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 6 quoted lines
> While the object storage format extension can already be configured
> manually via git-config(1), this isn't exactly an ergonomic way of doing
> so. For the reference storage format extension, users have a host of
> options available to them.
>
> Introduce the equivalent options for the object storage format.
[snip]
Show 13 quoted lines
> diff --git a/setup.c b/setup.c
> index 98140a7641..3d74f8eeed 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -2466,7 +2466,8 @@ void initialize_repository_version(struct repository *repo,
>  	 */
>  	if (hash_algo != GIT_HASH_SHA1_LEGACY ||
>  	    ref_storage_format != REF_STORAGE_FORMAT_FILES ||
> -	    repo->ref_storage_payload)
> +	    repo->ref_storage_payload ||
> +	    strcmp(repo->object_storage_format, "files"))
>  		target_version = GIT_REPO_VERSION_READ;
>

Okay so this is what also sets the 'core.repositoryformatversion' config. I was specifically looking for that.

Does this mean that even for the files odb with a payload we need v1 of 'core.repositoryformatversion'?

Show 11 quoted lines
>  	if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)
> @@ -2490,6 +2491,12 @@ void initialize_repository_version(struct repository *repo,
>  		repo_config_set_gently(repo, "extensions.refstorage", NULL);
>  	}
>
> +	if (strcmp(repo->object_storage_format, "files"))
> +		repo_config_set(repo, "extensions.objectstorage",
> +				repo->object_storage_format);
> +	else if (reinit)
> +		repo_config_set_gently(repo, "extensions.objectstorage", NULL);
> +

So this handled reinitializing the same repo. If there was a previously set object storage format, we unset it gently.

But, we already catch and error out if the extension before and after reinit differ, so this `else` block is not needed, no? Removing it passes all the tests in this patch.

Show 11 quoted lines
>  	if (reinit) {
>  		struct strbuf config = STRBUF_INIT;
>  		struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
> @@ -2726,6 +2733,7 @@ static void separate_git_dir(struct repository *repo,
>  struct default_format_config {
>  	int hash;
>  	enum ref_storage_format ref_storage_format;
> +	char *object_storage_format;
>  };
>
>  static int read_default_format_config(const char *key, const char *value,
[snip]
Show 5 quoted lines
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index d080ab04a8..0da14e8f70 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -898,6 +898,168 @@ test_expect_success DEFAULT_REPO_FORMAT 'GIT_OBJECT_STORAGE_FORMAT overrides ext
[snip]
Show 9 quoted lines
> +
> +test_expect_success 'init with --object-storage-format=files://<relative-path>' '
> +	test_when_finished "rm -rf objformat" &&
> +	git init --object-storage-format=files://objs objformat &&
> +	echo files://objs >expect &&
> +	git -C objformat config get extensions.objectstorage >actual &&
> +	test_cmp expect actual &&
> +	echo 1 >expect &&
>

Okay what I asked before is expected, files with payload is v1. Makes sense.

Show 11 quoted lines
> +	git -C objformat config get core.repositoryformatversion >actual &&
> +	test_cmp expect actual &&
> +	git -C objformat rev-parse --show-object-storage-format >actual &&
> +	echo files://objs >expect &&
> +	test_cmp expect actual &&
> +	test_path_is_dir objformat/.git/objects &&
> +	test_path_is_dir objformat/.git/objs &&
> +	test_commit -C objformat A &&
> +	git -C objformat rev-parse --verify HEAD &&
> +	test_path_is_missing objformat/.git/objects/pack &&
> +	test_path_is_dir objformat/.git/objs/pack

Super nit: some newlines in between would help improve readability of a few of these denser tests.

> +'
> +
[snip]
Nice. I like the extensive testing done here.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 29 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.