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

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

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 19, 2026, 21:29 UTC
Message-ID
<CAOLa=ZQj0sZu7WRzmvgZx23ZeO1KBtOm6yWOLCzeVP_86zkTPQ@mail.gmail.com>
In-Reply-To
<20261019-b4-pks-odb-extension-v1-2-143a5963b77f@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 22 quoted lines
> 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
> @@ -1235,6 +1235,7 @@ struct odb_files_dir *odb_source_files_find_dir(struct object_database *odb, con
>  }
>
>  struct odb_source_files *odb_source_files_new(struct object_database *odb,
> +					      const char *payload,
>  					      enum odb_new_flags flags)
>  {
>  	struct odb_source_files *files;
> @@ -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?

>  	if (!object_dir)
>  		object_dir = xstrfmt("%s/objects", odb->repo->commondir);
>
[snip]
Show 10 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.
[snip]
Show 20 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?
Show 9 quoted lines
> +	git -C objstorage config set extensions.objectStorage files &&
> +	test_commit -C objstorage A &&
> +	git -C objstorage rev-parse --verify HEAD
> +'
> +
> +test_expect_success DEFAULT_REPO_FORMAT 'extensions.objectStorage with unknown backend' '
> +	test_when_finished "rm -rf objstorage" &&
> +	git init objstorage &&
> +	git -C objstorage config set core.repositoryformatversion 1 &&
Same question here.
Show 9 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.

Show 6 quoted lines
>  test_expect_success MINGW 'core.hidedotfiles = false' '
>  	git config --global core.hidedotfiles false &&
>  	rm -rf newdir &&
>
> --
> 2.56.0.269.g68944adf51.dirty
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 7 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.