[PATCH 2/5] odb/files: create leading directories
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 5, 2026, 15:02 UTC
- Message-ID
- <20261105-pks-storage-format-improvements-v1-2-870bb4212518@pks.im>
- In-Reply-To
- <20261105-pks-storage-format-improvements-v1-0-870bb4212518@pks.im>
With the same reasoning as in the preceding commit, create leading directories when creating the "files" object backend on disk.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- odb/source-files.c | 1 + t/t0001-init.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/odb/source-files.c b/odb/source-files.c index 6b423499fe5..e7503548e38 100644 --- a/odb/source-files.c +++ b/odb/source-files.c @@ -97,6 +97,7 @@ static int odb_source_files_create_on_disk(struct odb_source *source, struct strbuf line = STRBUF_INIT; int ret; + safe_create_leading_directories_no_share(source->path); safe_create_dir(source->odb->repo, source->path, 1); strbuf_addf(&path, "%s/pack", source->path); diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 23317e0733a..735ab9d8475 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -944,13 +944,13 @@ test_expect_success 'init with --object-storage-format=files://<relative-path>' test_expect_success 'init with --object-storage-format=files://<absolute-path>' ' test_when_finished "rm -rf objformat objdir" && - git init --object-storage-format=files://"$(pwd)/objdir" objformat && - echo "files://$(pwd)/objdir" >expect && + git init --object-storage-format=files://"$(pwd)/absolute/objdir" objformat && + echo "files://$(pwd)/absolute/objdir" >expect && git -C objformat config get extensions.objectstorage >actual && test_cmp expect actual && test_commit -C objformat A && git -C objformat rev-parse --verify HEAD && - test_path_is_dir objdir/pack + test_path_is_dir absolute/objdir/pack ' test_expect_success 'GIT_OBJECT_DIRECTORY takes precedence over extensions.objectStorage payload' '
-- 2.56.0.500.g5d06dc02cd.dirty