From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.159 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796112264; b=I/K1gi3sdfj+re73GUpJJzmpTAvRIpv0XVxN/9y9xPpTgpu8tUOyGdsvvNDLssatHcL2 6/ObWYzHJMEqv77Ri2Tp/idU/NHdDiujmIpVbb1mGou5sez5c5F9kL5ZDAUmrH69fj3k3 3lmxvyXbYA7Upmpw/HzbFNT4gRDaM6ENlnqOSs13jRzDaNrCPlEf7T0J8oVEW7O9GWZxQ ZTG0DK592qOaaCSW/iUPfjkItSQhqU7XRJsn3RvaykW0kwhl4hLqRRDbgXeoY5oB/AguN QI/nKeP5F1I5FLPoU2baI3Bl5bJuUy4/hKL4hbZSiEAyq41Yrfu9XjnrYgfnvwkCQTQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796112264; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=iwrK1WdWpApnXKPScag4Q8BX7+V16HuJPcMuDEBHj7Y=; b=KS9QjedYl+0IbDxO7gI57gbOyyqgQLSGJCIcPlvC9vvuS4l8NBNDPb+GKh8OsFA1le+o jwQiOUQHErSY7hXWnJC0mkPTVLYSdou+nekB1EHTEzx/OcgdNuT/+bd/Rn9t/+3ye5ZmA YuVPCkath/tgVfLSKBuKehiEAs3bf6kY17l3uqs0Cux8EVpyBWrzItkYRUYDRABYU+602 ihFXRhlYJjrf0+WgUSDTNiv0OLUKobmZAtaDZrN4Gwfv4YCp1ALKmWaV2cUvdH8HiVbGv jDPAFqxjKuTrl0bkZGkWomgO8w0ol1L5S+3wZJTsffA9s8zrfDBtJr2kiGvxuZz8fIQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=ngtGwO7y; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=yvZWkChF; arc=none smtp.remote-ip=202.12.124.159 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 489E3606A31A for ; Tue, 1 Dec 2026 08:04:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 489E3606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=ngtGwO7y; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=yvZWkChF Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9724C7A0530 for ; Tue, 1 Dec 2026 03:04:23 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Tue, 01 Dec 2026 03:04:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1796112263; x=1796198663; bh=iwrK1WdWpA pnXKPScag4Q8BX7+V16HuJPcMuDEBHj7Y=; b=ngtGwO7yAtVRro8l4BrFJEFXSD YkmaYkh4VLNClu1dLKQMOd3C6B73R1OQ6rwO0gSUiw+URkluABMWXn4V48pFR+C6 YCMVNZsHrUUo+wzL9nGdCMU4iTkOmx1Monsv0M07LhOPm3VV9ocn+Dib5DPwcmpV A8ZQbdDacBQyUM4Mh/8l6WcOMmjWohVdkRyET5wlrE8xebxLsMERr54lbTg1P9b9 E3/mnr4Y52Qf0ucA80ptpDm2HoJp+ATLmynLNr+bNvgCReD11e0wratbT4Ta1V0f asspS6RKjXiVCBs6G0Bypg6Gwy9EhW/2/MOgIVGUchVyLsxt10ZrhBMIF6+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796112263; x=1796198663; bh=iwrK1WdWpApnXKPScag4Q8BX7+V16HuJPcM uDEBHj7Y=; b=yvZWkChF4hWgj68TM8Rd8NssnuHNC+bocsTG6HT7F0u2PwgoSBm YOI8xdp7kThPE9RuKtZ28isfA9ubkgSfPXxqG3nDtgLpudnRpAySkoGIaoAAJ0lJ G2rSQSquf3P2FWFgMhyD108iNZHZ3m4cLz+lu4Rf+I/hVvEyf0CfAxNVLx+ryPYP TiePGzPHmIfxaJ6d9CSvJUUD5iapPlXHio0geM5gksKWzssHGcrwHWeARpgX4Spx ysNFYCLHGTghgIpdh+pa6Jk9PhsArdByg/8y7ju4DAeffZdZHwtotmE1xA5hQr0Y yaaSQgtQGN4Uye+Uca30hy7wTS4gBdVYXbw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796112263; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:UgQqiRMUygtrwudKaqP/EfzKGQ1JerDXySSX698aps0vO34 0D5HusGnH1/qPm0JQepL/IhGloDgfcVlVvWrlVOKrf8XDez/j+BJP1vK8vX0x5U/ +/MiZnM+vlsYSLMQRpXBDMToDjGhAEw5V4pBb9pezeTCPm/KaFcbBCxW2A8K7i2p ZAHGLy3ATWnBBv+SKw1xXE+khNiMFdAQJ5jzu3C/k1Ks562MghnG2FcPYul+GGq+ XRSwe8iDmgWprQTTUTwvGqya5lArm+1drQJhgopQbsjl/vV+biGFZ3UZ7vEfmP4K tbaqZU389Fky9tAbbKx4IEpaxx3Ed0AqgivyORA==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:+hHtuPjqRtckKEEOWlWJAE9gmN9iTdbOIw7M+M7kp88=:aUH7GJ+l3sR3O145r4FM07vXqrDhGxG0GbK7GUvchyk=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGZ/N2y2kwaQm9rGwiXmQvcceWS5IOr26UqLeCphy+aH8MLlHxzo5MvlFMBryocs9 k86CGti/CCX6eAuFnCpTuyzeUVrrFGL/2vKBj9+eWYnuaDqPW34tHOMpOuFlCrlbA8SscK W0VYfW9W7xKr8kGzJKsxULS/V+eSwqYbAsU7sFC77LFY//i3mhy8BStT6vmIGIa8Mqb+zX PyuxdcEPGlTKRP73tX/u5KHgKdGWgp/D29rG61SdWd/bNeMXrdi4sBqXx5lJjZx1ZkJ2px iAt8WCath3xKd0RQz33T0mg8RwjA9dOAudHNOcl0GyioCj1rutIixJtoqjzbnKTl9rwJOw +tOOXvcbAi94dUciOMAWHrmW1IZ90CdPvZQtQHvoMKAWXwZnxYUYV+qVVmRUMyxIV5KbrR GFQrVJb1CxJSxnRE3DDtLwuO1MUG/8FFIlSRwjIOE3pnwprafd/8v10zwmJTW/k7CXA+sK trrWRWAdEkdLkVtuR3mJajWaNQWX6cATHtFFdxqqlhA6ztXs/33fn5EiY5C3cz/9D2YSmI ZV4iRXgl7ETYY9MQ7PAYHQZ8La6Ll0vH0KqucXWEjeufJoXHGw7oQyELNpW2sdDaQCH8Mg PUZN0VoxO1E0UhZM9Lp3XUzO70GyGuHOpI37Z/VwGzaQolrmSd0Y2R1+YNRw X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Dec 2026 03:04:22 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id 250c75f8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 1 Dec 2026 08:04:21 +0000 (UTC) Date: Tue, 1 Dec 2026 09:04:18 +0100 From: Patrick Steinhardt To: Toon Claes Cc: git@vger.kernel.org, "brian m. carlson" Subject: Re: [PATCH] setup: use SHA-256 when experimental features are enabled Message-ID: References: <20261201-toon-init-experimental-sha256-v1-1-eecd8454be9e@iotcl.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 01, 2026 at 08:59:19AM +0100, Patrick Steinhardt wrote: > On Tue, Dec 01, 2026 at 07:47:09AM +0100, Toon Claes wrote: > > In 793b14e1c8 (setup: use "reftable" format when experimental features > > are enabled, 2025-07-04), git-init(1) learned to create new repositories > > with the reftable backend when "feature.experimental" is enabled, so > > that users can test the format that is planned to become the default in > > Git 3.0. The SHA-256 object format is also planned to become the default > > in Git 3.0, but "feature.experimental" does not affect the object > > format, so new repositories still use SHA-1. > > Huh, interesting, I thought that "feature.experimental" already did > this! > > > Teach "feature.experimental" to also make SHA-256 the default object > > format for new repositories. As with the ref storage format, this > > default can still be overridden by setting "init.defaultObjectFormat", > > setting the GIT_DEFAULT_HASH environment variable, or passing > > "--object-format=". > > This makes a ton of sense. Now that we're moving closer to Git 3.0 we > should make sure to give upcoming breaking changes more exposure. > > > diff --git a/setup.c b/setup.c > > index f9c03b6c47..d4c263d599 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -2850,13 +2850,16 @@ static int read_default_format_config(const char *key, const char *value, > > } > > > > /* > > - * Enable the reftable format when "features.experimental" is enabled. > > - * "init.defaultRefStorageFormat" takes precedence over this setting. > > + * Enable the reftable format and the SHA-256 object format when > > + * "features.experimental" is enabled. "init.defaultRefStorageFormat" > > + * and "init.defaultObjectFormat" take precedence over this setting. > > */ > > if (!strcmp(key, "feature.experimental") && > > - cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN && > > git_config_bool(key, value)) { > > - cfg->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE; > > + if (cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN) > > + cfg->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE; > > + if (cfg->hash == GIT_HASH_UNKNOWN) > > + cfg->hash = GIT_HASH_SHA256; > > Looks straight-forward. And this function still knows to properly > override the hash in case "init.defaultObjectFormat" was set. Good. > > > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > > index 9e57a06cea..da73ae7395 100755 > > --- a/t/t0001-init.sh > > +++ b/t/t0001-init.sh > > @@ -575,6 +575,40 @@ test_expect_success 'init warns about invalid init.defaultObjectFormat' ' > > test_cmp expected actual > > ' > > > > +test_expect_success 'init with feature.experimental=true uses sha256' ' > > + test_when_finished "rm -rf repo" && > > + test_config_global feature.experimental true && > > + ( > > + sane_unset GIT_DEFAULT_HASH && > > + git init repo > > + ) && > > + echo sha256 >expect && > > + git -C repo rev-parse --show-object-format >actual && > > + test_cmp expect actual > > +' > > + > > +test_expect_success 'init.defaultObjectFormat overrides feature.experimental=true' ' > > + test_when_finished "rm -rf repo" && > > + test_config_global feature.experimental true && > > + test_config_global init.defaultObjectFormat sha1 && > > + ( > > + sane_unset GIT_DEFAULT_HASH && > > + git init repo > > + ) && > > + echo sha1 >expect && > > + git -C repo rev-parse --show-object-format >actual && > > + test_cmp expect actual > > +' > > + > > +test_expect_success 'GIT_DEFAULT_HASH overrides feature.experimental=true' ' > > + test_when_finished "rm -rf repo" && > > + test_config_global feature.experimental true && > > + GIT_DEFAULT_HASH=sha1 git init repo && > > + echo sha1 >expect && > > + git -C repo rev-parse --show-object-format >actual && > > + test_cmp expect actual > > +' > > We could also verify that "--object-format=sha256" overrides > "feature.experimental", but eventually it becomes excessive. > > Another thing we might want to test is whether git-clone(1) works as > expected with "feature.experimental" set when cloning a SHA1 repo. But > I'm somewhat sure that our test suite would probably catch such an issue > if it didn't. > > So overall this looks good to me, thanks! Ah, one more note: this should probably land after [1], as we would otherwise potentially reinitialize a repository with the wrong hash if "feature.experimental" was set. Patrick [1]: <20261124225952.1616547-1-sandals@crustytoothpaste.net>