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

Re: [PATCH v2] setup: fix hash algorithm detection

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 16, 2026, 06:22 UTC
Message-ID
<avqhPfANDZqeWGmo@pks.im>
In-Reply-To
<20261113221753.3408862-1-sandals@crustytoothpaste.net>
On Fri, Nov 13, 2026 at 10:17:53PM +0000, brian m. carlson wrote:
Show 7 quoted lines
> 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.

Show 19 quoted lines
> 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
Previous: Junio C HamanoNext: brian m. carlson
Message 11 of 17 in “Default object format for new repositories in Git v3”
  1. Adam DinwoodieNov 6, 2026
  2. brian m. carlsonNov 6, 2026
  3. setup: default hash algo to GIT_HASH_DEFAULTbrian m. carlson, Nov 8, 2026
  4. Junio C HamanoNov 8, 2026
  5. brian m. carlsonNov 8, 2026
  6. Junio C HamanoNov 8, 2026
  7. Junio C HamanoNov 9, 2026
  8. Patrick SteinhardtNov 9, 2026
  9. setup: fix hash algorithm detectionbrian m. carlson, Nov 13, 2026
  10. Junio C HamanoNov 14, 2026
  11. Patrick SteinhardtNov 16, 2026
  12. setup: fix hash algorithm detectionbrian m. carlson, Nov 19, 2026
  13. Patrick SteinhardtNov 19, 2026
  14. Junio C HamanoNov 19, 2026
  15. Junio C HamanoNov 19, 2026
  16. brian m. carlsonNov 19, 2026
  17. Junio C HamanoNov 19, 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.