From: Junio C Hamano Date: Thu, 21 May 2026 16:49:24 GMT Subject: Re: [PATCH 1/8] t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORY Message-ID: In-Reply-To: <20260521-b4-pks-setup-centralize-odb-creation-v1-1-f130d2a7e8ae@pks.im> Patrick Steinhardt writes: > In subsequent commits we'll rework how we set up the repository. This is > a somewhat intricate and thus fragile sequence, there's many things that > can go subtly wrong, and there are lots of interesting interactions that > one can discover. > > One such discovered edge case was the interaction between git-init(1) > and the "GIT_OBJECT_DIRECTORY" enviroment variable. When set, the "environment"??? > behaviour is that the object directory should be created at the path > that the variable points to. This behaviour is documented as such in > its man page: > > If the object storage directory is specified via the > GIT_OBJECT_DIRECTORY environment variable then the sha1 directories > are created underneath; otherwise, the default $GIT_DIR/objects > directory is used. > > Curiously enough though we don't seem to have any tests that exercise > this directly, and thus a subsequent commit inadvertently broke this > expectation. > > Plug this test gap. Nice. > Signed-off-by: Patrick Steinhardt > --- > t/t0001-init.sh | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index e4d32bb4d2..e89feca544 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -980,4 +980,14 @@ test_expect_success 're-init reads matching includeIf.onbranch' ' > test_cmp expect err > ' > > +test_expect_success 'init honors GIT_OBJECT_DIRECTORY' ' > + test_when_finished "rm -rf init-objdir custom-odb" && > + mkdir custom-odb && > + env GIT_OBJECT_DIRECTORY="$(pwd)/custom-odb" \ > + git init init-objdir && > + test_path_is_missing init-objdir/.git/objects/pack && > + test_path_is_dir custom-odb/pack && > + test_path_is_dir custom-odb/info > +' > + > test_done