From: Rasmus Villemoes <ravi@prevas.dk>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, emkan@prevas.dk
Subject: Re: git clone with --dissociate sometimes fails to check out target commit
Date: Mon, 04 May 2026 13:36:46 +0200 [thread overview]
Message-ID: <874ikns8xd.fsf@prevas.dk> (raw)
In-Reply-To: <20260504095110.GA599780@coredump.intra.peff.net> (Jeff King's message of "Mon, 4 May 2026 05:51:10 -0400")
On Mon, May 04 2026, Jeff King <peff@peff.net> wrote:
> On Mon, May 04, 2026 at 10:20:32AM +0200, Rasmus Villemoes wrote:
>
>> Are we using --dissociate wrongly, or are we perhaps not maintaining
>> those local mirror repos properly? They are essentially just created
>> with 'git clone --mirror', with 'git remote update' run periodically.
>>
>> Naively, I'd expect the effects of --dissociate to only happen after
>> everything else the clone command does has been done, but it seems that
>> the ties to the reference repo are cut too soon.
>
> No, you're using it correctly. The dissociate step should copy all of
> the shared objects into the new repo, so it shouldn't matter whether we
> do it before or after checkout. The objects are there either way.
>
[snip]
>
> It's kind of ugly, but I think may be the least-bad solution. See that
> earlier thread for more discussion of alternatives.
>
> In the meantime, doing your dissociate clone with:
>
> git -c core.commitGraph=false clone ...
>
> should work around the problem.
Thanks for the extremely fast reply, analysis, patch and workaround!
I can confirm that the commit graph disabling workaround works on both
the Debian and Arch machines.
I can also confirm that the patch applied on top of v2.54.0 works,
although the build does throw this warning:
commit.c: In function ‘get_commit_tree_oid’:
commit.c:481:66: warning: passing argument 2 of ‘repo_get_commit_tree’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
481 | struct tree *tree = repo_get_commit_tree(the_repository, commit);
| ^~~~~~
commit.c:459:50: note: expected ‘struct commit *’ but argument is of type ‘const struct commit *’
459 | struct commit *commit)
| ~~~~~~~~~~~~~~~^~~~~~
Thanks again,
Rasmus
prev parent reply other threads:[~2026-05-04 11:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 8:20 git clone with --dissociate sometimes fails to check out target commit Rasmus Villemoes
2026-05-04 9:51 ` Jeff King
2026-05-04 9:54 ` Jeff King
2026-05-04 11:36 ` Rasmus Villemoes [this message]
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=874ikns8xd.fsf@prevas.dk \
--to=ravi@prevas.dk \
--cc=emkan@prevas.dk \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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