Re: git fails to checkout SHA1 submodule in SHA256 repo with --depth=1
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Nov 12, 2025, 23:37 UTC
- Message-ID
- <aRUaR6IfH9imrF5A@fruit.crustytoothpaste.net>
- In-Reply-To
- <xmqq7bvvtdoe.fsf@gitster.g>
On 2025-11-12 at 16:32:01, Junio C Hamano wrote:
Show 12 quoted lines
> Martin Wilck <mwilck@suse.com> writes: > > >> Subject: Re: git fails to checkout SHA1 submodule in SHA256 repo with --depth=1 > > I think it is not supposed to work to mix repositories like this, > regardless of any other option like --depth. I think brian gave a > response to that effect in a thread in the past few months. > > ... goes and looks ... > > https://lore.kernel.org/git/aJ5gOPQ9oologqj-@fruit.crustytoothpaste.net/ > https://lore.kernel.org/git/aKPJNNWMW9gtueEK@fruit.crustytoothpaste.net/
Yes, that isn't going to work and it never will unless we add some extension mechanism for that purpose. The repository in question is corrupt.
I've just written a patch to check for this case and produce an error in git add, which I will send shortly.
-- brian m. carlson (they/them) Toronto, Ontario, CA