Git development
 help / color / mirror / Atom feed
From: Daniel Mach <daniel.mach@suse.com>
To: git@vger.kernel.org
Subject: git clone fails when using --dissociate together with a reference repository that contains a commit-graph
Date: Tue, 12 May 2026 09:35:49 +0200	[thread overview]
Message-ID: <6ae85515-9373-4c9e-90d2-5e4176590c5b@suse.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1403 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 3034 bytes --]

[-- Attachment #2: reproducer_git_clone_dissociate.sh --]
[-- Type: application/x-shellscript, Size: 1335 bytes --]

             reply	other threads:[~2026-05-12  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  7:35 Daniel Mach [this message]
2026-05-12 18:38 ` git clone fails when using --dissociate together with a reference repository that contains a commit-graph Jeff King

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=6ae85515-9373-4c9e-90d2-5e4176590c5b@suse.com \
    --to=daniel.mach@suse.com \
    --cc=git@vger.kernel.org \
    /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