Article View: linux.kernel.git
Article #4235Re: [PATCH] setup: use SHA-256 when experimental features are enabled
From: "brian m. carlson"
Date: Tue, 01 Dec 2026 23:19
Date: Tue, 01 Dec 2026 23:19
85 lines
12607 bytes
12607 bytes
--dfekXErJUD9RThE/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On 2026-12-01 at 06:47:09, 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.
>=20
> 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=3D".
>=20
> Signed-off-by: Toon Claes <toon@iotcl.com>
> ---
> With the release of Git 3.0 being planned, I noticed SHA-256 isn't
> default-selected when "feature.experimental" is set. This small patch
> fixes that.
>=20
> This follows what Patrick did for the reftable backend in [1], which
> made "feature.experimental" select the reftable format for new
> repositories.
>=20
> There is a related topic in flight, bc/setup-default-hash-algo [2],
> which fixes the default hash algorithm not being applied by git-init(1)
> in WITH_BREAKING_CHANGES builds. It touches the same area of setup.c,
> but this patch does not depend on it and both merge cleanly together.
This seems like a sensible patch and a sensible default. It looks good
to me.
> 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,
> }
> =20
> /*
> - * 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 =3D=3D REF_STORAGE_FORMAT_UNKNOWN &&
> git_config_bool(key, value)) {
> - cfg->ref_storage_format =3D REF_STORAGE_FORMAT_REFTABLE;
> + if (cfg->ref_storage_format =3D=3D REF_STORAGE_FORMAT_UNKNOWN)
> + cfg->ref_storage_format =3D REF_STORAGE_FORMAT_REFTABLE;
> + if (cfg->hash =3D=3D GIT_HASH_UNKNOWN)
> + cfg->hash =3D GIT_HASH_SHA256;
I was curious as to whether this would actually ever be set to
`GIT_HASH_UNKNOWN` and therefore whether this would actually work, given
the conversation I recently had with Junio, but the tests you wrote
answered that question for me, so thank you for those.
--=20
brian m. carlson (they/them)
Toronto, Ontario, CA
Speaking for myself only
--dfekXErJUD9RThE/
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
wr0EABYKAG8FgmsPVfsJEHwMSWKIh6KBRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
LnNlcXVvaWEtcGdwLm9yZ1DOjAcs/2ObYfyhUpsjdexgMgIQZq8v3xTeLBfuHB2o
FiEECCzmip28ZfuD0cORfAxJYoiHooEAAGV9AQCQWHq9Ezbvky8g6a7e+WAUwOar
FZcLz/VAEfhFNPj2owEAwYfYiL3KuQP9kYUSS5/Eh7gz3DIcgCQTbLN1Za/MlQY=
=0p8B
-----END PGP SIGNATURE-----
--dfekXErJUD9RThE/--
Technical Details
Message-ID:
<aw9V-9vK1ut5MggZ@fruit.crustytoothpaste.net>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76831-linux-kernel-git=dewy.ruReferences:
<20261201-toon-init-experimental-sha256-v1-1-eecd8454be9e@iotcl.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76831-linux-kernel-git=dewy.ru
From: sandals@crustytoothpaste.net ("brian m. carlson")
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] setup: use SHA-256 when experimental features are enabled
Date: Tue, 1 Dec 2026 23:19:23 +0000
Organization: Usenet Network
Message-ID: <aw9V-9vK1ut5MggZ@fruit.crustytoothpaste.net>
References: <20261201-toon-init-experimental-sha256-v1-1-eecd8454be9e@iotcl.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="dfekXErJUD9RThE/"
Injection-Info: usenet.network;
logging-data="1840937"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:hAyYjordFx/nieYGkNuk7tsFIG4= sha256:abdxsJkqUVskON7tG3uAs9IkKE84v7y7M2WWReTYxzs=
sha1:vY/L0FQgIBH5A+BYJjxsxVQdyhk= sha256:NLjbbDjbpKw+AeONdMwrQhfqG/GTMWzEuw/JnZi3fLk=
Content-Disposition: inline
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 50CE81174D1; Wed, 2 Dec 2026 02:19:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.951
X-Spam-Status: No, score=-1.951 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (3072-bit key)
header.d=crustytoothpaste.net
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id A8LpGSOcxAis;
Wed, 2 Dec 2026 02:19:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76831-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=crustytoothpaste.net
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 92FCB116173; Wed, 2 Dec 2026 02:19:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 0994A2ADC7; Tue, 1 Dec 2026 23:19:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796167173;
b=Wx06dQc78dnj34MaxyTpIXZubAD9wiyIy8bzNxhnhp99hT7ZNPGnIeHWTEMrjlEFMLMf
IDnsz/p5yUzu3fL84jCch3N6M6M2Js6UKhO4nKIecbkJtMw2+2v5bSPpWfl/1oVR1Ve6n
ALLWVDVSYLldxS/FweDm+cfZxJw6N1dttB/HhOoM98cHls/lFsDGhMJREu83p1Zuokek1
LYkhugmtxLC5fC8YllfJFZAtp5MLHfjdQhrNDB+it6h5KVZLuvjyryFXcWvaA6eobDwNV
idRdm2RVPwBwGMgU6fQ4jC+goDkzlLlcrETxoAq6V3VhgMB8hPC4ySq7CsGeppI2dNw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796167173;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To:User-Agent;
bh=YKjQccknYcYF4DW3iX6B6SvefoO6lGT6ZZspOGzgrWQ=;
b=HPGYutOKwt7to8H8aFLlP0ahWbw5WPYS2Goyr/7byd7SCoznxXCd2m782g8YuKVsg8XQ
gJPijzg81Hr9NXZ4+yUOzyDgFblLBD9OrItHLMq9qqElMLPq4Ni/DToWiZTsJngo8SkmZ
RmKvW4Nzr2DbHPOYlw61s6SKgW/7vO0+O4gwD4N1hKee3hrJfcukJWeRXdV6S8Y2hs2r3
GCeFZo55hacRtVGgsmNYIE5NkPC259RqDbAxg0i8kGvaxIbfeS9ZXE4OFuGv8gaKdlMOC
9IIbRfVg5aJIVqyBMEkfOMBTD7lbIVNTWfaV8ctshprSkFGVPTYjVogCdk//FWMr3Hg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b="UEk1K6/2";
dmarc=pass header.from=crustytoothpaste.net;
spf=pass smtp.mailfrom=crustytoothpaste.net;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D0908606A329;
Tue, 1 Dec 2026 23:19:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=UEk1K6/2
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=172.105.7.114
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796167173;
b=Z04PTkH6qEaiYqGaifgBZIc/8icgXlNsiGTvrRg0SCO5VWbPkDYNzkal7TuhXpxb0rP5
0DHR/gQk/peYpo/BnlVxCYByoz74wkUSi8EbwzE5D7/jt7qKWkX6QGIoUiVvj257m/AcS
shqgtpQFEyZJ1zhIhlB5rjbnI/y0/vCv8niHVctyHypGSfpo/GRrwjuH7o3hp3fEKxHo/
3vBq7wNgUDpYtzbMg+gmQEtpGn/hm6BqVK2rDxiiGHD3VerFR9Aj2ISFh67Pgkm0bYvBI
NsH32f99aEX5h/+Ph6WST8Eo3Ct6ueHSx3/RrhzWKR9paQJaH+5650w52sz+qdc5aMQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796167173;
h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To:User-Agent;
bh=YKjQccknYcYF4DW3iX6B6SvefoO6lGT6ZZspOGzgrWQ=;
b=RO5D++IyVfArohHduFgS6RLnW9gQPIwbKFGTwSC6LdR99XD04keFGXKwMaZNXUL4bceh
JIDkGNGxL0BmJ4V0hIR6JPfYUqz4iPJ3LgzD3kdY1w3YYP/k1Mk1rCw1FvpxX367670uy
SOSMrLfyOT6Pue7WFCP+pp8Ikebr2N2n+4FUPGjcVrWJCA34udgoqIXn0CMECjEgRcRtd
UhQe6pWkrKqfKOpE83zbNsfc0trvvK9uAUsr1QbEae7aKz7umr5irOV1RBTjjQhL41tLX
weoOdegwE6sbmPRMly0/hLn8xhkRPWOrrnFeVY9ZDWMa4SxPudyq9Ouy1+yyiRdL+tQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=crustytoothpaste.net;
spf=pass smtp.mailfrom=crustytoothpaste.net;
dkim=pass header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b="UEk1K6/2";
arc=none smtp.remote-ip=172.105.7.114
X-Received: from complex.crustytoothpaste.net (complex.crustytoothpaste.net [172.105.7.114])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64365606A31A
for <git@vger.kernel.org>; Tue, 1 Dec 2026 23:19:32 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 64365606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crustytoothpaste.net
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crustytoothpaste.net
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net;
s=default; t=1796167165;
bh=Gm98Rr+nTbNmE3jP8WdmE7B7+sqP5s3zBxzAQ3uaLb0=;
h=Date:From:To:Cc:Subject:References:Content-Type:
Content-Disposition:In-Reply-To:From:Reply-To:Subject:Date:To:CC:
Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To:References:
Content-Type:Content-Disposition;
b=UEk1K6/29d7OqAq5e0WHhKEq8du00+Alw6yXII2oRaWgM3CdmmwplK3+oY6lR+hQE
ic8obxVg2uo1jhOEtG21nuKzJrhH634Gj1L5SNvSm0BZmnHeSGV8zMSL73V3/tKSF0
mdXjbVqCC2EnCEw1TDiRlA/IZTOw89dl0eFy8I4WCCcyRauQamtV/qav110d+DKQ5F
GA/JhnTp6thtMOcWD6K1yrsjCofvmiIJfx/FuyKQJznNw72d49UOEG335ZxNEFq5OU
uugFPI3a+fNwVHyhy2w+QXGqKKEdulRlUg3kFYa9SzuV/IHy/U9hqIEludMpd2HpkN
u+hC1ICPhIUZAORS9Ym6unBTpdg6Qelgp0iHOcSSv6PaRWtOIrbNHBFXMoXkZgcA/j
/dMIwfxNstymt37JF4Lm5KzCq6JbNUGEg+d5WK8K1AYzZr5EA7PFb+enRGgTWY/fyj
UCLOYVClLcC7DuHqrT0GMqMiQ1gVcyCiJbHQ1y6okPB8C1b1QSQ
X-Received: from fruit.crustytoothpaste.net (unknown [IPv6:2607:f2c0:f00f:f901:7c88:3a44:d23a:1092])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by complex.crustytoothpaste.net (Postfix) with ESMTPSA id 264E1200B1;
Tue, 1 Dec 2026 23:19:25 +0000 (UTC)
X-Cc: git@vger.kernel.org
X-Mail-Followup-To: "brian m. carlson" <sandals@crustytoothpaste.net>,
Toon Claes <toon@iotcl.com>, git@vger.kernel.org
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261201-toon-init-experimental-sha256-v1-1-eecd8454be9e@iotcl.com>
X-User-Agent: Mutt/2.4.1 (2026-07-04)