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

Re: [PATCH v2 0/3] contrib/subtree: reduce recursion during split

From
IJIan Jackson <ijackson@chiark.greenend.org.uk>
Date
Apr 16, 2026, 13:25 UTC
Message-ID
<27104.58166.993109.63505@chiark.greenend.org.uk>
In-Reply-To
<20260305-cs-subtree-split-recursion-v2-0-7266be870ba9@howdoi.land>
Colin Stagner writes ("[PATCH v2 0/3] contrib/subtree: reduce recursion during split"):
> On Debian's POSIX sh, shell recursion is artificially limited
> to 1000 calls. You can check if your sh has limited recursion
> with:

FTR Debian supports multiple options for /bin/sh. The shell in question, with the limit that's troubling us, is dash.

> Depending on the history graph, subtree split can recurse deeply
> enough to encounter this limit. Rewrite the rejoin-deepening
> algorithm to reduce recursive calls.

Hi. I'm a git-subtree user and indeed I was the one who reported the bug Colin is trying to fix. I would be happy to do a code review of these changes.

However, before I get stuck into that, which seems like it will involve some serious staring at shell code, I'd like to ask what seems like a logically prior question:

Why not run the script under bash in non-POSIX mode instead? I think that would sidestep the problem. If you don't want this program to always depend on bash, you could have a little snippet at the top to re-exec with bash if (1) it's available (2) we don't seem to be running under bash already. (Presumably the Debian package of git would need to Recommend bash then.)

TBH I was quite surprised, when I reported this bug some time ago, to find that git-subtree was written in shell. If it had been me I would probably have used Rust and libgit2.

Ian.
-- 
Ian Jackson <ijackson@chiark.greenend.org.uk>   These opinions are my own.  

Pronouns: they/he.  If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.
Previous: Ben KnobleNext: Junio C Hamano
Message 9 of 22 in “contrib/subtree: reduce recursion during split”
  1. 0/3 contrib/subtree: reduce recursion during splitColin Stagner, Mar 5, 2026
  2. 1/3 contrib/subtree: reduce function side-effectsColin Stagner, Mar 5, 2026
  3. 2/3 contrib/subtree: functionalize split traversalColin Stagner, Mar 5, 2026
  4. 3/3 contrib/subtree: reduce recursion during splitColin Stagner, Mar 5, 2026
  5. Junio C HamanoMar 13, 2026
  6. Junio C HamanoMar 13, 2026
  7. Junio C HamanoApr 15, 2026
  8. Ben KnobleApr 15, 2026
  9. Ian JacksonApr 16, 2026
  10. Junio C HamanoApr 16, 2026
  11. Colin StagnerApr 17, 2026
  12. Ian JacksonApr 19, 2026
  13. Ben KnobleApr 20, 2026
  14. Junio C HamanoApr 20, 2026
  15. Ian JacksonApr 20, 2026
  16. Colin StagnerApr 21, 2026
  17. Johannes SchindelinApr 22, 2026
  18. git-subtree rewriteIan Jackson, Apr 22, 2026
  19. Junio C HamanoJun 1, 2026
  20. Ian JacksonJun 2, 2026
  21. Colin StagnerJun 3, 2026
  22. Ian JacksonJun 3, 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.