From: Patrick Steinhardt Date: Mon, 16 Nov 2026 06:22:53 GMT Subject: Re: [PATCH v2] setup: fix hash algorithm detection Message-ID: In-Reply-To: <20261113221753.3408862-1-sandals@crustytoothpaste.net> On Fri, Nov 13, 2026 at 10:17:53PM +0000, brian m. carlson wrote: > diff --git a/setup.c b/setup.c > index 61bcdafe82..14c6e1a67d 100644 > --- a/setup.c > +++ b/setup.c > @@ -2817,19 +2817,20 @@ static void repository_format_configure(struct repository_format *repo_fmt, > * Otherwise, if the user has specified one on the command line, use it. > */ This comment is now a bit stale, as it talks about re-initializing the repository with an incompatible hash algorithm. But that only gets detected further down now. Do we maybe want to update it to have the same bulleted list of precedence that we also have for the ref and object storage formats? The code changes look as expected to me and resemble what we have for the two storage formats. > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index f1d227f271..d8244a2dec 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -516,6 +516,22 @@ test_expect_success 're-init from a linked worktree' ' > ) > ' > > +test_expect_success 'git init uses default object format' ' > + test_when_finished "rm -rf repo" && > + ( > + sane_unset GIT_DEFAULT_HASH && > + git init repo && > + if test_have_prereq WITH_BREAKING_CHANGES > + then > + echo sha256 > + else > + echo sha1 > + fi >expect && I think we can just use GIT_TEST_BUILTIN_HASH for this, which detects the hash via `git verson --build-options`. Thanks! Patrick