Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: <git@vger.kernel.org>,  Patrick Steinhardt <ps@pks.im>,
	 Adam Dinwoodie <adam@dinwoodie.org>
Subject: Re: [PATCH v4] setup: fix hash algorithm detection
Date: Mon, 23 Nov 2026 08:25:16 -0800	[thread overview]
Message-ID: <xmqq4id7bjmb.fsf@gitster.g> (raw)
In-Reply-To: <20261123011403.720209-1-sandals@crustytoothpaste.net> (brian m. carlson's message of "Mon, 23 Nov 2026 01:14:03 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> +test_expect_success 're-init does not modify hash from config' '
> +	test_when_finished "rm -rf repo" &&
> +	(
> +		sane_unset GIT_DEFAULT_HASH &&
> +		for algo in sha1 sha256
> +		do
> +			if test "$algo" = sha1
> +			then
> +				other=sha256
> +			else
> +				other=sha1
> +			fi &&
> +			git init --object-format="$algo" repo &&
> +			test_config_global init.defaultObjectFormat "$other" &&
> +			git init repo &&
> +			echo "$algo" >expect &&
> +			git -C repo rev-parse --show-object-format >actual &&
> +			test_cmp expect actual &&
> +			rm -fr repo || exit 1
> +		done
> +	)
> +'

error: bug in the test script: test_when_finished does nothing in a subshell
not ok 62 - re-init does not modify hash from config

I think it is test_config_global that is getting complained.  Perhaps
something along this line would fix it.

 t/t0001-init.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git c/t/t0001-init.sh w/t/t0001-init.sh
index 5def3f98b7..58271c8fac 100755
--- c/t/t0001-init.sh
+++ w/t/t0001-init.sh
@@ -638,6 +638,7 @@ test_expect_success 'init refuses to reinitialize with different hash' '
 
 test_expect_success 're-init does not modify hash from config' '
 	test_when_finished "rm -rf repo" &&
+	test_when_finished "test_unconfig --global init.defaultObjectFormat" &&
 	(
 		sane_unset GIT_DEFAULT_HASH &&
 		for algo in sha1 sha256
@@ -649,7 +650,7 @@ test_expect_success 're-init does not modify hash from config' '
 				other=sha1
 			fi &&
 			git init --object-format="$algo" repo &&
-			test_config_global init.defaultObjectFormat "$other" &&
+			git config --global init.defaultObjectFormat "$other" &&
 			git init repo &&
 			echo "$algo" >expect &&
 			git -C repo rev-parse --show-object-format >actual &&




  parent reply	other threads:[~2026-11-23 16:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 16:50 Default object format for new repositories in Git v3 Adam Dinwoodie
2026-11-06 20:46 ` brian m. carlson
2026-11-08  1:16 ` [PATCH] setup: default hash algo to GIT_HASH_DEFAULT brian m. carlson
2026-11-08  4:42   ` Junio C Hamano
2026-11-08 14:38     ` brian m. carlson
2026-11-08 18:22   ` Junio C Hamano
2026-11-09  2:21     ` Junio C Hamano
2026-11-09  9:54       ` Patrick Steinhardt
2026-11-13 22:17   ` [PATCH v2] setup: fix hash algorithm detection brian m. carlson
2026-11-14  0:16     ` Junio C Hamano
2026-11-16  6:22     ` Patrick Steinhardt
2026-11-19  1:06   ` [PATCH v3] " brian m. carlson
2026-11-19  9:52     ` Patrick Steinhardt
2026-11-19 16:26     ` Junio C Hamano
2026-11-19 16:38     ` Junio C Hamano
2026-11-19 22:20       ` brian m. carlson
2026-11-19 23:06         ` Junio C Hamano
2026-11-23  1:14   ` [PATCH v4] " brian m. carlson
2026-11-23  2:29     ` Junio C Hamano
2026-11-23 16:14     ` Junio C Hamano
2026-11-23 16:25     ` Junio C Hamano [this message]
2026-11-23 22:13       ` brian m. carlson
2026-11-24  0:01         ` Junio C Hamano
2026-11-24 22:59   ` [PATCH v5] " brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4id7bjmb.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=adam@dinwoodie.org \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox