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

Re: [PATCH v6] subtree: fix split processing with multiple subtrees present

From
Zach FettersMoore <zach.fetters@apollographql.com>
Date
Dec 11, 2023, 15:39 UTC
Message-ID
<CAEWN6q3RTbVuMb0VyCYz196ZL+OGAAHbJLZ2-MnW1RVVabg7Mw@mail.gmail.com>
In-Reply-To
<CAP8UFD3FzP6QW4dJ9yiG1BAytLcsk+zGE+CBeArRJBJ8gsaDMQ@mail.gmail.com>
Show 26 quoted lines
>>
>> From: Zach FettersMoore <zach.fetters@apollographql.com>
>>
>> When there are multiple subtrees present in a repository and they are
>> all using 'git subtree split', the 'split' command can take a
>> significant (and constantly growing) amount of time to run even when
>> using the '--rejoin' flag. This is due to the fact that when processing
>> commits to determine the last known split to start from when looking
>> for changes, if there has been a split/merge done from another subtree
>> there will be 2 split commits, one mainline and one subtree, for the
>> second subtree that are part of the processing. The non-mainline
>> subtree split commit will cause the processing to always need to search
>> the entire history of the given subtree as part of its processing even
>> though those commits are totally irrelevant to the current subtree
>> split being run.
>>
>> To see this in practice you can use the open source GitHub repo
>> 'apollo-ios-dev' and do the following in order:
>>
>> -Make a changes to a file in 'apollo-ios' and 'apollo-ios-codegen'
>> directories
>> -Create a commit containing these changes
>> -Do a split on apollo-ios-codegen
>> - Do a fetch on the subtree repo
>> - git fetch git@github.com:apollographql/apollo-ios-codegen.git
>> - git subtree split --prefix=apollo-ios-codegen --squash --rejoin
Show 15 quoted lines
> Now I get the following without your patch at this step:
>
> $ git subtree split --prefix=apollo-ios-codegen --squash --rejoin
> [...]/libexec/git-core/git-subtree: 318: Maximum function recursion
> depth (1000) reached
>
> Line 318 in git-subtree.sh contains the following:
>
> missed=$(cache_miss "$@") || exit $?
>
> With your patch it seems to work:
>
> $ git subtree split --prefix=apollo-ios-codegen --squash --rejoin
> Merge made by the 'ort' strategy.
> e274aed3ba6d0659fb4cc014587cf31c1e8df7f4

Looking into this some it looks like it could be a bash config difference? My machine always runs it all the way through vs failing for recursion depth. Although that would also be an issue which is solved by this fix.

>> - Depending on the current state of the 'apollo-ios-dev' repo
>> you may see the issue at this point if the last split was on
>> apollo-ios
> I guess I see it, but it seems a bit different for me than what you describe.
>
> Otherwise your patch looks good to me now.

Yea I hadn't accounted for/realized that some folks may see a recursion depth error vs it just taking a long time like it does for me. Also what I was saying with the apollo-ios-dev repo is you may not need all the steps to see the issue, because its possible the state of the repo is already in a position to display the issue just by doing a split on apollo-ios-codegen.

Great! Thanks again for all the feedback and guidance! Is there anything else I need to do to get this across the finish line and merged in?

Previous: Christian CouderNext: Christian Couder
Message 20 of 30 in “subtree: fix split processing with multiple subtrees present”
  1. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 18, 2023
  2. Junio C HamanoSep 18, 2023
  3. Junio C HamanoSep 19, 2023
  4. Zach FettersMooreOct 26, 2023
  5. 0/2 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 22, 2023
  6. 2/2 subtree: changing location of commit ignore processingZach FettersMoore via GitGitGadget, Sep 22, 2023
  7. 1/2 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 22, 2023
  8. 0/3 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 29, 2023
  9. 2/3 subtree: changing location of commit ignore processingZach FettersMoore via GitGitGadget, Sep 29, 2023
  10. 3/3 subtree: adding test to validate fixZach FettersMoore via GitGitGadget, Sep 29, 2023
  11. 1/3 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 29, 2023
  12. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Oct 26, 2023
  13. Christian CouderNov 18, 2023
  14. Zach FettersMooreNov 28, 2023
  15. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Nov 28, 2023
  16. Christian CouderNov 30, 2023
  17. Zach FettersMooreNov 30, 2023
  18. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Dec 1, 2023
  19. Christian CouderDec 4, 2023
  20. Zach FettersMooreDec 11, 2023
  21. Christian CouderDec 12, 2023
  22. Junio C HamanoDec 12, 2023
  23. Zach FettersMooreDec 13, 2023
  24. Christian CouderJan 3, 2024
  25. Christian CouderDec 20, 2023
  26. Christian CouderJan 25, 2024
  27. Junio C HamanoJan 25, 2024
  28. Christian CouderJan 25, 2024
  29. Junio C HamanoJan 25, 2024
  30. subtree: [v2.44 regression] split may produce different historyColin Stagner, Aug 21, 2025

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.