From: george@mail.dietrich.pub
To: george@mail.dietrich.pub
Cc: git@vger.kernel.org
Subject: Re: [Bug] Git subtree regression
Date: Tue, 30 Dec 2025 12:07:19 -0500 [thread overview]
Message-ID: <20251230170719.845029-1-george@mail.dietrich.pub> (raw)
In-Reply-To: <176677910605.6.2281395015810449820.1087545551@dietrich.pub>
---
I explored this more and think I found the root cause.
Commit `83f9dad7d6fb5988b68f80b25bd87c68693195dd` changed `should_ignore_subtree_split_commit()` to examine only a commit's own trailers via `git show --format='%(trailers:...)'`.
The old code used `git log -1 --grep=...` which had the important side effect of searching through ancestor commits.
In a multi-subtree monorepo with this topology:
```
main: A---B---M---E (B = subtree add --squash for subA)
/
feature: C---D (D = subtree add --squash for subB)
```
When splitting `subA`, commits `C` and `D` from the feature branch should be **ignored** because they belong to a branch that only contains `subB`, not `subA`.
## Old behavior (2.51.1)
`git log -1 --grep="git-subtree-dir:"` on commit `C` would traverse ancestors and find `D`'s subtree markers for `subB`, correctly identifying `C` as belonging to another subtree's branch.
## New behavior (2.52.0)
`git show` on commit `C` finds no trailers (regular commits don't have them), so `C` is **not** ignored.
This breaks the split because both parents of the merge `M` are processed, but `C` has no cache entry, leading to disconnected history.
Thus, split operations produce fewer commits than expected with broken parent chains, breaking push/pull workflows to upstream subtree repositories.
## Reproduction
This can be reproduced via my monorepo: https://github.com/athena-framework/athena
```bash
# 2.51.1 produces correct result (matches the number of commits in the `athena-framework/clock` repo)
$ git subtree split --prefix="src/components/clock"
4ee66f8198b2532110b75a36575e363ccccff47e # 20 commits, connected to remote
# 2.52.0 produces broken result
$ git subtree split --prefix="src/components/clock"
0efb3d9858e3bfee65165508aeeacc50417c9a99 # 7 commits, disconnected
# The commits have identical trees but different parents:
$ git cat-file -p 4ee66f8198b2532110b75a36575e363ccccff47e
tree 8333b0cbb2a10528f8c803812af7a8e603e70367
parent d72f22f28ca5ed57ef3c2df74f0abd5569ac5934 # Connected to 19-commit history
$ git cat-file -p 0efb3d9858e3bfee65165508aeeacc50417c9a99
tree 8333b0cbb2a10528f8c803812af7a8e603e70367
parent 81c5dbe70ce26a7758fbe7f87b3ce0704043cfb1 # Only 6 commits, disconnected
```
next prev parent reply other threads:[~2025-12-30 17:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-26 19:58 [Bug] Git subtree regression dev
2025-12-30 17:07 ` george [this message]
2026-01-04 4:52 ` Colin Stagner
2026-01-04 14:27 ` george
2026-01-05 3:36 ` Colin Stagner
2026-01-06 4:55 ` george
2026-01-10 1:25 ` Colin Stagner
2026-01-10 17:22 ` george
2026-02-15 20:36 ` Colin Stagner
2026-02-16 21:25 ` D. Ben Knoble
2026-02-18 4:29 ` george
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=20251230170719.845029-1-george@mail.dietrich.pub \
--to=george@mail.dietrich.pub \
--cc=git@vger.kernel.org \
/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