<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/subtree, branch seen</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=seen</id>
<link rel='self' href='https://git.shady.money/git/atom?h=seen'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-17T21:26:32Z</updated>
<entry>
<title>Merge branch 'cs/subtree-split-recursion' into seen</title>
<updated>2026-04-17T21:26:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-17T21:26:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0363623f5be397ddeac650d2473ff2fddee1b273'/>
<id>urn:sha1:0363623f5be397ddeac650d2473ff2fddee1b273</id>
<content type='text'>
When processing large history graphs on Debian or Ubuntu, "git
subtree" can die with a "recursion depth reached" error.

Comments?

* cs/subtree-split-recursion:
  contrib/subtree: reduce recursion during split
  contrib/subtree: functionalize split traversal
  contrib/subtree: reduce function side-effects
</content>
</entry>
<entry>
<title>builds: move build scripts into "tools/"</title>
<updated>2026-03-19T13:40:09Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-19T05:33:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a767f2fd6c5a6104ff32a35a27f0c15aec546957'/>
<id>urn:sha1:a767f2fd6c5a6104ff32a35a27f0c15aec546957</id>
<content type='text'>
We have a bunch of scripts used by our different build systems that are
all located in the top-level directory. Now that we have introduced the
new "tools/" directory though we have a better home for them.

Move the scripts into the "tools/" directory.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: reduce recursion during split</title>
<updated>2026-03-06T21:57:48Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-03-05T23:55:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c30871b91d4d01ddf24f8129e23aff9da0a57575'/>
<id>urn:sha1:c30871b91d4d01ddf24f8129e23aff9da0a57575</id>
<content type='text'>
On Debian-alikes, POSIX sh has a hardcoded recursion depth
of 1000. This limit operates like bash's `$FUNCNEST` [1], but
it does not actually respect `$FUNCNEST`. This is non-standard
behavior. On other distros, the sh recursion depth is limited
only by the available stack size.

With certain history graphs, subtree splits are recursive—with
one recursion per commit. Attempting to split complex repos that
have thousands of commits, like [2], may fail on these distros.

Reduce the amount of recursion required by eagerly discovering
the complete range of commits to process.

The recursion is a side-effect of the rejoin-finder in
`find_existing_splits`. Rejoin mode, as in

    git subtree split --rejoin -b hax main ...

improves the speed of later splits by merging the split history
back into `main`. This gives the splitting algorithm a stopping
point. The rejoin maps one commit on `main` to one split commit
on `hax`. If we encounter this commit, we know that it maps to
`hax`.

But this is only a single point in the history. Many splits
require history from before the rejoin. See patch content for
examples.

If pre-rejoin history is required, `check_parents` recursively
discovers each individual parent, with one recursion per commit.
The recursion deepens the entire tree, even if an older rejoin
is available. This quickly overwhelms the Debian sh stack.

Instead of recursively processing each commit, process *all* the
commits back to the next obvious starting point: i.e., either the
next-oldest --rejoin or the beginning of history. This is where the
recursion is likely to stop anyway.

While this still requires recursion, it is *considerably* less
recursive.

[1]: https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-FUNCNEST

[2]: https://github.com/christian-heusel/aur.git

Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: functionalize split traversal</title>
<updated>2026-03-06T21:57:48Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-03-05T23:55:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b3ace4d5bb72cb1845e547439b53e00dcf49b8e'/>
<id>urn:sha1:3b3ace4d5bb72cb1845e547439b53e00dcf49b8e</id>
<content type='text'>
`git subtree split` requires an ancestor-first history traversal.
Refactor the existing rev-list traversal into its own function,
`find_commits_to_split`.

Pass unrevs via stdin to avoid limits on the maximum length of
command-line arguments. Also remove an unnecessary `eval`.

Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: reduce function side-effects</title>
<updated>2026-03-06T21:57:48Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-03-05T23:55:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f8e90b972ef9567df2d6983ae2c5f1f2659e86ad'/>
<id>urn:sha1:f8e90b972ef9567df2d6983ae2c5f1f2659e86ad</id>
<content type='text'>
`process_subtree_split_trailer()` communicates its return value
to the caller by setting a variable (`sub`) that is also defined
by the calling function. This is both unclear and encourages
side-effects.

Invoke this function in a sub-shell instead.

Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cs/subtree-split-fixes'</title>
<updated>2026-03-03T19:08:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-03T19:08:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f9980cfebad39326546e4db1f614bdaf783f51b'/>
<id>urn:sha1:2f9980cfebad39326546e4db1f614bdaf783f51b</id>
<content type='text'>
An earlier attempt to optimize "git subtree" discarded too much
relevant histories, which has been corrected.

* cs/subtree-split-fixes:
  contrib/subtree: process out-of-prefix subtrees
  contrib/subtree: test history depth
  contrib/subtree: capture additional test-cases
</content>
</entry>
<entry>
<title>Merge branch 'ps/validate-prefix-in-subtree-split'</title>
<updated>2026-03-03T01:06:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-03T01:06:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=146487360cb0e08ec412b477347670e1a114c6ca'/>
<id>urn:sha1:146487360cb0e08ec412b477347670e1a114c6ca</id>
<content type='text'>
"git subtree split --prefix=P &lt;commit&gt;" now checks the prefix P
against the tree of the (potentially quite different from the
current working tree) given commit.

* ps/validate-prefix-in-subtree-split:
  subtree: validate --prefix against commit in split
</content>
</entry>
<entry>
<title>contrib/subtree: process out-of-prefix subtrees</title>
<updated>2026-02-20T18:15:31Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-02-18T02:31:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1f70684b517f4fcfeb7b998b0b7f3146ee8a8c75'/>
<id>urn:sha1:1f70684b517f4fcfeb7b998b0b7f3146ee8a8c75</id>
<content type='text'>
`should_ignore_subtree_split_commit` detects subtrees which are
outside of the current path --prefix and ignores them. This can
speed up splits of repositories that have many subtrees.

Since its inception [1], every iteration of this logic [2], [3]
incorrectly excludes commits. This alters the split history. The
split history and its commit hashes are API contract, so this is
not permissible.

While a commit from a different subtree may look like it doesn't
contribute anything to a split, sometimes it does. Merge commits
are a particular hot spot. For these, the pruning logic in
`copy_or_skip` performs:

1. a check for "treesame" parents
2. two different common ancestry checks

These checks operate on the **split history**, not the input
history. The split history omits commits that do not affect the
--prefix. This can significantly alter the ancestry of a merge.
In order to determine if `copy_or_skip` will skip a merge, it
is likely necessary to compute all the split history... which
is what `should_ignore_subtree_split_commit` tries to avoid.

To make this logic API-preserving, we could gate it behind a
new CLI argument. The present implementation is actually a
speed penalty in many cases, however, so this is not done here.

Remove the `should_ignore_subtree_split_commit` logic. This
fixes the regression reported in [4].

[1]: 98ba49ccc2 (subtree: fix split processing with multiple subtrees present, 2023-12-01)

[2]: 83f9dad7d6 (contrib/subtree: fix split with squashed subtrees, 2025-09-09)

[3]: 28a7e27cff (contrib/subtree: detect rewritten subtree commits, 2026-01-09)

[4]: &lt;20251230170719.845029-1-george@mail.dietrich.pub&gt;

Reported-by: George &lt;george@mail.dietrich.pub&gt;
Reported-by: Christian Heusel &lt;christian@heusel.eu&gt;
Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: test history depth</title>
<updated>2026-02-20T18:15:31Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-02-18T02:31:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=715b406e47d51a6f4f6be3b0ed42cfbd59217258'/>
<id>urn:sha1:715b406e47d51a6f4f6be3b0ed42cfbd59217258</id>
<content type='text'>
Add history depth checks to some of the subtree unit tests.

These checks were previously introduced as part of 28a7e27cff
(contrib/subtree: detect rewritten subtree commits, 2026-01-09),
which has since been reverted.

Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: capture additional test-cases</title>
<updated>2026-02-20T18:15:31Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-02-18T02:31:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=767ee993b7ea3175691444af67550817de7f6c73'/>
<id>urn:sha1:767ee993b7ea3175691444af67550817de7f6c73</id>
<content type='text'>
Patch series e7b07376e5 (Merge branch 'rs/subtree-fixes',
2018-10-26) corrects several defects in `git subtree split`.
The defects affect `split --rejoin` and merge commit processing.

There is no test coverage for this, and e7b07376e5 did not
introduce any.

Convert the minimum working example [1] from the original patch
submission [2] into test cases.

[1]: https://gist.github.com/FoxFireX/1b794384612b7fd5e7cd157cff96269e

[2]: &lt;20180928183540.48968-1-roger.strain@swri.org&gt;

Signed-off-by: Colin Stagner &lt;ask+git@howdoi.land&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
