Git development
 help / color / mirror / Atom feed
From: Ian Jackson <ijackson@chiark.greenend.org.uk>
To: Colin Stagner <ask+git@howdoi.land>
Cc: git@vger.kernel.org, Christian Heusel <christian@heusel.eu>,
	george@mail.dietrich.pub, Christian Hesse <list@eworm.de>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 0/3] contrib/subtree: reduce recursion during split
Date: Thu, 16 Apr 2026 14:25:10 +0100	[thread overview]
Message-ID: <27104.58166.993109.63505@chiark.greenend.org.uk> (raw)
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.

  parent reply	other threads:[~2026-04-16 14:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-15 20:17 [PATCH 0/3] contrib/subtree: reduce recursion during split Colin Stagner
2026-02-15 20:17 ` [PATCH 1/3] contrib/subtree: reduce function side-effects Colin Stagner
2026-02-15 20:17 ` [PATCH 2/3] contrib/subtree: functionalize split traversal Colin Stagner
2026-02-15 20:17 ` [PATCH 3/3] contrib/subtree: reduce recursion during split Colin Stagner
2026-03-05 23:55 ` [PATCH v2 0/3] " Colin Stagner
2026-03-05 23:55   ` [PATCH v2 1/3] contrib/subtree: reduce function side-effects Colin Stagner
2026-03-05 23:55   ` [PATCH v2 2/3] contrib/subtree: functionalize split traversal Colin Stagner
2026-03-05 23:55   ` [PATCH v2 3/3] contrib/subtree: reduce recursion during split Colin Stagner
2026-03-13 22:51   ` [PATCH v2 0/3] " Junio C Hamano
2026-03-13 23:06     ` Junio C Hamano
2026-04-15 17:58       ` Junio C Hamano
2026-04-15 21:39         ` Ben Knoble
2026-04-16 13:25   ` Ian Jackson [this message]
2026-04-16 19:34     ` Junio C Hamano
2026-04-17  4:50     ` Colin Stagner
2026-04-19 19:55       ` Ian Jackson
2026-04-20  1:09         ` Ben Knoble
2026-04-20  1:50         ` Junio C Hamano
2026-04-20  9:57         ` Ian Jackson
2026-04-21  5:07           ` Colin Stagner
2026-04-22  9:43             ` Johannes Schindelin
2026-04-22 17:12           ` git-subtree rewrite Ian Jackson

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=27104.58166.993109.63505@chiark.greenend.org.uk \
    --to=ijackson@chiark.greenend.org.uk \
    --cc=ask+git@howdoi.land \
    --cc=christian@heusel.eu \
    --cc=george@mail.dietrich.pub \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=list@eworm.de \
    --cc=phillip.wood@dunelm.org.uk \
    /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