[PATCH 0/3] contrib/subtree: reduce recursion during split
- From
- Colin Stagner <ask+git@howdoi.land>
- Date
- Feb 15, 2026, 20:17 UTC
- Message-ID
- <20260215201748.889866-1-ask+git@howdoi.land>
* cs/subtree-split-recursion: when processing large history graphs on Debian or Ubuntu, "git subtree" can die with a "recursion depth reached" error. Reduce recursion.
On Debian's POSIX sh, shell recursion is artificially limited to 1000 calls. You can check if your sh has limited recursion with:
#!/bin/sh
recurse() {
r=$(( r + 1 ))
test "$r" -le 1000 || { echo OK; exit; }
recurse
} && r=0 && recurseDepending on the history graph, subtree split can recurse deeply enough to encounter this limit. Rewrite the rejoin-deepening algorithm to reduce recursive calls.
Colin Stagner (3): contrib/subtree: reduce function side-effects contrib/subtree: functionalize split traversal contrib/subtree: reduce recursion during split
contrib/subtree/git-subtree.sh | 95 +++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 7 deletions(-)
base-commit: 852829b3dd2fe4e7c7fc4d8badde644cf1b66c74
-- 2.43.0