From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=172.105.7.114 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== 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== 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 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 ; Tue, 1 Dec 2026 23:19:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 64365606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crustytoothpaste.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crustytoothpaste.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (3072-bit key, unprotected) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=UEk1K6/2 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 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) Date: Tue, 1 Dec 2026 23:19:23 +0000 From: "brian m. carlson" To: Toon Claes Cc: git@vger.kernel.org Subject: Re: [PATCH] setup: use SHA-256 when experimental features are enabled Message-ID: Mail-Followup-To: "brian m. carlson" , Toon Claes , git@vger.kernel.org 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: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dfekXErJUD9RThE/" Content-Disposition: inline In-Reply-To: <20261201-toon-init-experimental-sha256-v1-1-eecd8454be9e@iotcl.com> User-Agent: Mutt/2.4.1 (2026-07-04) --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 > --- > 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/--