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
Patrick Steinhardt <ps@pks.im>
Date
Oct 23, 2026, 05:33 UTC
Message-ID
<atrxjqESUSunxsqU@pks.im>
In-Reply-To
<CAOLa=ZRzu_7No085hEHnULo0L50y=ntx3MSkb-VbcywChdOPZA@mail.gmail.com>
On Wed, Oct 21, 2026 at 10:23:17AM -0400, Karthik Nayak wrote:
Show 20 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> > 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'?

Yes. Repository extensions aren't read in the case where we have a v0 repository, so we cannot make use of any non-default object storage format there.

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

This is a slightly different case: if you have a repository that uses the default storage format, but that explicitly configures the "files" format, then we downgrade the repository format version to 0 and unset the extension again. This logic basically matches what we do with the ref backend, too.

I noticed there's no test for this though. And that then led me down the rabbit hole, because I'm not particularly happy with some of the logic here. For example, I was doing normalization of "files" vs "files://" somewhat inconsistently.

So I've redone some of the infrastructure here to be much closer to what we do with the ref backend. Currently we track the object storage format as a single URI that we pass around, whereas for the ref storage format we pass around a backend type and payload. And that makes normalization a lot easier, and we don't have to re-parse the URI in a lot of places.

So I've adapted the series now to use the same approach. It also makes stuff easier to reason about, as we basically have the exact same logic for both storage types in most places.

I'll send that later today.
Patrick
Previous: Karthik NayakNext: Patrick Steinhardt
Message 30 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.