From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Martin Wilck <mwilck@suse.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Adrian Schroeter <adrian@suse.com>
Subject: Re: git fails to checkout SHA1 submodule in SHA256 repo with --depth=1
Date: Thu, 13 Nov 2025 22:51:44 +0000 [thread overview]
Message-ID: <aRZhAEpm8PbBQcIM@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <a1c0440a6eef8f306f53793b2f96636945d4ced4.camel@suse.com>
[-- Attachment #1: Type: text/plain, Size: 3961 bytes --]
On 2025-11-13 at 10:15:30, Martin Wilck wrote:
> Let me just explain the use case: The distribution ((open)SUSE) has
> switched to git for version control of its packages. We have chosen
> SHA256, because we'll need to support the distribution for many years
> to come, much longer than SHA1 is going to be considered good enough.
>
> We can store the source code of the package e.g. in the form of
> tarballs (and we do). But it's convenient and efficient, and thus
> tempting for developers, to simply link to an existing repository
> hosting the sources, using a submodule. And upstream repos still use
> SHA1. This is what lead us to experiment with this sort of mixed
> repository.
>
> I get it that the concept is flawed and unsupported. Up to now, that
> wasn't obvious to me.
It wasn't obvious to a lot of people because the assumption is only
documented in the transition plan. Mixed algorithm submodules are
something we should have thought about earlier on, but we didn't.
The original transition plan was to have full interoperability support
early on, in which case this wouldn't have been a problem, but for
technical reasons it ended up being much easier to have SHA-256-only
repositories, so we finished that first. I then lost interest in the
project for many years (having kind of burnt out on the work) and, with
the exception of one set of patches that were sent in, nobody else
picked it up either. So this ideally would have been implemented sooner
under the original plan, but it wasn't. This is one of the pitfalls of
open source projects, as we all know.
> So what we can do now is either keep storing tarballs, or wait until
> there's a full solution for migration between / interoperability of
> different hash algorithms, and until the source code repos we're
> interested in have been fully migrated to SHA256. In some special
> cases, where (open)SUSE owns the source repositories, we may be able to
> simply migrate to a SHA256 forge. We can also invent a "poor man's
> submodule" mechanism to link to sources on some external repository
> from ours [1].
There is work underway for SHA-1/SHA-256 interoperability. However, it
is a thing I'm working on primarily in my free time (although also a
little at work) and nobody else has stepped up to contribute, so it will
take some time to complete and is not expected to be included in Git
3.0 without additional assistance.
To be clear, the existing interoperability code does work for
repositories without submodules and you may find it on the
`sha256-interop` branch at https://github.com/bk2204/git.git, but it
isn't production ready. I might use it myself, but I would not
recommend others do so in its current state.
For right now, I would say that you should keep storing tarballs.
> Another question: If I, in the current repo [2], create a commit on top
> removing the submodule and replacing it by a tarball, would the
> repository remain broken, as it would still have the deprecated
> SHA256/SHA1 combination in the history? Should I expect errors if run
> e.g. "git rebase" or "git bisect" in a repository like this? IOW, do I
> need to rewrite the history of this repo, eliminating all instances of
> such mixed-hash submodules, to be on the safe side?
If the mismatched submodule remains in the history, then it will be
broken, so you'll almost certainly want to rewrite the history.
When the interoperability work is done and fully functional, a
repository in this situation will not work at all with dual algorithms.
The reason for that is that the SHA-256 main repository will try to use
the submodule value as a SHA-256 submodule (using the incorrect padded
SHA-1 value as a SHA-256 value) and it won't be able to create the
appropriate SHA-1/SHA-256 mapping since that object ID doesn't really
exist in the submodule.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2025-11-13 22:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 12:58 git fails to checkout SHA1 submodule in SHA256 repo with --depth=1 Martin Wilck
2025-11-12 16:32 ` Junio C Hamano
2025-11-12 23:37 ` brian m. carlson
2025-11-13 10:15 ` Martin Wilck
2025-11-13 22:51 ` brian m. carlson [this message]
2025-11-13 22:57 ` Martin Wilck
2025-11-14 22:55 ` Marc Branchaud
2025-11-15 20:14 ` brian m. carlson
2025-11-12 23:54 ` [PATCH] object-file: disallow adding submodules of different hash algo brian m. carlson
2025-11-13 3:26 ` Jeff King
2025-11-13 3:56 ` Jeff King
2025-11-13 16:29 ` Junio C Hamano
2025-11-14 23:26 ` brian m. carlson
2025-11-15 1:53 ` Jeff King
2025-11-13 23:15 ` brian m. carlson
2025-11-15 0:58 ` [PATCH v2 1/2] " brian m. carlson
2025-11-15 0:58 ` [PATCH v2 2/2] read-cache: drop submodule check from add_to_cache() brian m. carlson
2025-11-15 19:57 ` Junio C Hamano
2025-11-15 20:06 ` brian m. carlson
2025-11-15 19:53 ` [PATCH v2 1/2] object-file: disallow adding submodules of different hash algo Junio C Hamano
2025-11-17 8:53 ` Martin Wilck
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=aRZhAEpm8PbBQcIM@fruit.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=adrian@suse.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mwilck@suse.com \
/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;
as well as URLs for NNTP newsgroup(s).