<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/subtree, branch main</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=main</id>
<link rel='self' href='https://git.shady.money/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-03-03T19:08:12Z</updated>
<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>
<entry>
<title>contrib/subtree: fix tests with reftable backend</title>
<updated>2026-02-04T17:33:59Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-02-04T04:38:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=486386c687609603a2c1ebc434384d1e380908ae'/>
<id>urn:sha1:486386c687609603a2c1ebc434384d1e380908ae</id>
<content type='text'>
One git-subtree test-case relies on git internals to infer the
default branch name. This test fails with the new reftable
backend.

    GIT_TEST_DEFAULT_REF_FORMAT=reftable \
      meson test t7900-subtree

This test script already sets

    GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main

which eliminates the need to infer a branch name at runtime.
Hardcode the branch name.

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>subtree: validate --prefix against commit in split</title>
<updated>2026-02-03T17:26:45Z</updated>
<author>
<name>Pushkar Singh</name>
<email>pushkarkumarsingh1970@gmail.com</email>
</author>
<published>2026-02-03T16:48:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a606fcdceb807b93013542e5e4d5f4c233aa6c83'/>
<id>urn:sha1:a606fcdceb807b93013542e5e4d5f4c233aa6c83</id>
<content type='text'>
git subtree split currently validates --prefix against the working tree.
This breaks when splitting an older commit or when the working tree does
not contain the subtree, even though the commit does.

For example:

  git subtree split --prefix=pkg &lt;commit&gt;

fails if pkg was removed later, even though it exists in &lt;commit&gt;.

Fix this by validating the prefix against the specified commit using
git cat-file instead of the working tree.

Add a test to ensure this behavior does not regress.

Signed-off-by: Pushkar Singh &lt;pushkarkumarsingh1970@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Revert "Merge branch 'cs/rebased-subtree-split'"</title>
<updated>2026-01-26T06:37:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-01-25T17:43:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ab689ea7f91ab0858e85776f31102203d3ea7b83'/>
<id>urn:sha1:ab689ea7f91ab0858e85776f31102203d3ea7b83</id>
<content type='text'>
This reverts commit 79e3055baba32e2952e6e8994cdcd4fc145ba7f0, reversing
changes made to 9813aace1e52765e01e688672cdcdcbe25336ec7.

Regresison report

    https://lore.kernel.org/git/755578cb-07e0-4b40-aa90-aacf4d45ccaa@heusel.eu/
</content>
</entry>
<entry>
<title>contrib/subtree: detect rewritten subtree commits</title>
<updated>2026-01-10T04:21:43Z</updated>
<author>
<name>Colin Stagner</name>
<email>ask+git@howdoi.land</email>
</author>
<published>2026-01-10T01:18:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=28a7e27cff717e5ef91f7445e6a418068608082d'/>
<id>urn:sha1:28a7e27cff717e5ef91f7445e6a418068608082d</id>
<content type='text'>
    git subtree split --prefix P

detects splits that are outside of path prefix `P` and prunes
them from history graph processing. This improves the performance
of repeated `split --rejoin` with many different prefixes.

Both before and after 83f9dad7d6 (contrib/subtree: fix split with
squashed subtrees, 2025-09-09), the pruning logic does not detect
**rebased** or **cherry-picked** git-subtree commits. If `split`
encounters any of these commits, the split output may have
incomplete history.

All commits authored by

    git subtree merge [--squash] --prefix Q

have a first or second parent that has *only* subtree commits
as ancestors. When splitting a completely different path `P/`,
it is safe to ignore:

1. the merged tree
2. the subtree parent
3. *all* of that parent's ancestry, which applies only to
   path `Q/` and not `P/`.

But this relationship no longer holds if the git-subtree commit
is rebased or otherwise reauthored. After a rebase, the former
git-subtree commit will have other unrelated commits as ancestors.
Ignoring these commits may exclude the history of `P/`,
leading to incomplete `subtree split` output.

The pruning logic relies solely on the `git-subtree-*:` trailers
to detect git-subtree commits, which it blindly accepts without
further validation. The split logic also takes its time about
being wrong: `cmd_split()` execs a `git show` for *every* commit
in the split range… twice. This is inefficient in a shell script.

Add a "reality check" to ignore rebased or rewritten commits:

* Rewrites of non-merge commits cannot be detected, so the new
  detector no longer looks for them.

* Merges carry a `git-subtree-mainline:` trailer with the hash of
  the **first parent**. If this hash differs, or if the "merge"
  commit no longer has multiple parents, a rewrite has occurred.

To increase speed, package this logic in a new method,
`find_other_splits()`. Perform the check up-front by iterating
over a single `git log`. Add ignored subtrees to:

1. the `notree` cache, which excludes them from the `split` history

2. a `prune` negative refs list. The negative refs prevent
   recursing into other subtrees. Since there are potentially a
   *lot* of these, cache them on disk and use rev-list's
   `--stdin` mode.

Reported-by: George &lt;george@mail.dietrich.pub&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>meson: make GIT_HTML_PATH configurable</title>
<updated>2025-11-06T17:58:56Z</updated>
<author>
<name>D. Ben Knoble</name>
<email>ben.knoble+github@gmail.com</email>
</author>
<published>2025-11-04T13:58:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d63417e3ad67e5857cd52f9177fe39719d6ac84a'/>
<id>urn:sha1:d63417e3ad67e5857cd52f9177fe39719d6ac84a</id>
<content type='text'>
Makefile-based builds can configure Git's internal HTML_PATH by defining
htmldir, which is useful for packagers that put documentation in
different locations. Gentoo, for example, uses version-suffixed
directories like ${prefix}/share/doc/git-2.51 and puts the HTML
documentation in an 'html' subdirectory of the same.

Propagate the same configuration knob to Meson-based builds so that
"git --html-path" on such systems can be configured to output the
correct directory.

Signed-off-by: D. Ben Knoble &lt;ben.knoble+github@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
