Volume XXII, number 280Wednesday, October 7, 2026Latest message 59 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

git clone fails when using --dissociate together with a reference repository that contains a commit-graph

2 messages between May 12, 2026 and May 12, 2026, from Daniel Mach, Jeff King.

Plain Markdown or JSON for tools and agents.

Daniel MachMay 12, 2026, 07:35 UTC on lore
Hi,
I've stumbled upon a bug that the following command failed:

$ git clone <url> <dir> --reference <old-dir> --dissociate fatal: unable to parse commit <SHA> warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'

Omitting --dissociate fixed the error, but it wasn't clear to me what might be the root cause.

$ git --version git version 2.54.0

With the help of AI I was able to create a reproducer (see the attached script). I have verified that the reproducer works and also simplified it.

AI generated report (take it with a grain of salt):
* The Bug: During dissociation, Git correctly repacks objects and 
removes the objects/info/alternates file. However, the git clone process 
has already initialized its object store including the alternate's 
commit-graph.
   After dissociation, it fails to "forget" or reload the object store, 
leading to a crash when it tries to use the commit-graph (which refers 
to the now-unlinked alternate) to perform the initial checkout.
* Proof of state: As shown in the script output, a manual git checkout 
immediately after the failure succeeds, proving the repository is 
structurally sound but the clone process itself was in an inconsistent 
state.
* Workaround: Passing -c core.commitGraph=false to the clone command 
prevents the crash.

regards, Daniel

Jeff KingMay 12, 2026, 18:38 UTC in reply to Daniel Mach on lore

Re: git clone fails when using --dissociate together with a reference repository that contains a commit-graph

On Tue, May 12, 2026 at 09:35:49AM +0200, Daniel Mach wrote:
Show 10 quoted lines
> I've stumbled upon a bug that the following command failed:
> 
> $ git clone <url> <dir> --reference <old-dir> --dissociate
> fatal: unable to parse commit <SHA>
> warning: Clone succeeded, but checkout failed.
> You can inspect what was checked out with 'git status'
> and retry with 'git restore --source=HEAD :/'
> 
> Omitting --dissociate fixed the error, but it wasn't clear to me what might
> be the root cause.
I think this is the same bug discussed here:
  https://lore.kernel.org/git/20260504095110.GA599780@coredump.intra.peff.net/

I haven't worked up a more polished patch yet because I was trying to decide between the approach given there (to lazily fall back to manual parsing) versus filling in all of the dependent tree fields when closing the commit-graph. Which one is cheaper depends on the access patterns (how many commits will actually be looked at post-close, versus how many were ever loaded).

-Peff

Back to recent threads