From: george@mail.dietrich.pub Date: Tue, 30 Dec 2025 17:07:19 GMT Subject: Re: [Bug] Git subtree regression Message-ID: <20251230170719.845029-1-george@mail.dietrich.pub> 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 ```