git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git clone with --dissociate sometimes fails to check out target commit

From
RVRasmus Villemoes <ravi@prevas.dk>
Date
May 4, 2026, 11:36 UTC
Message-ID
<874ikns8xd.fsf@prevas.dk>
In-Reply-To
<20260504095110.GA599780@coredump.intra.peff.net>
On Mon, May 04 2026, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> 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]
Show 9 quoted lines
>
> 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

Previous: Jeff King
Message 4 of 4 in “git clone with --dissociate sometimes fails to check out target commit”
  1. Rasmus VillemoesMay 4, 2026
  2. Jeff KingMay 4, 2026
  3. Jeff KingMay 4, 2026
  4. Rasmus VillemoesMay 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.