git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] Git subtree regression

From
CSColin Stagner <ask+git@howdoi.land>
Date
Jan 4, 2026, 04:52 UTC
Message-ID
<e25b4d76-c1b5-4b6b-ba77-e1e2f7243ce9@howdoi.land>
In-Reply-To
<20251230170719.845029-1-george@mail.dietrich.pub>
Hello, George!
Thanks for looking in to this.
On 12/30/25 11:07, george@mail.dietrich.pub wrote:
> ---
> 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.

The old `--grep=...` approach was introduced as a performance speedup for large splits. I don't believe the original author intended to alter the split result, but the old approach inadvertently did in some cases.

> # 2.52.0 produces broken result
> $ git subtree split --prefix="src/components/clock"
> 0efb3d9858e3bfee65165508aeeacc50417c9a99  # 7 commits,
On v2.52.0 on my machine, I get an error instead:
      fatal: could not rev-parse split hash 
d0ed70566b3e962fbff71145d8155986b48c6885 from commit 
5817d4435bf448f526c3b0049f00e6500277e4bb
I presume I need more history than just master to make this work.

Can you test this split command in git v2.43.7? This is before `should_ignore_subtree_split_commit()` was introduced.

I'd like to distill this down into a minimum working example that doesn't depend on an external repo like athena. Namely, some shell instructions that start from an empty `git init` and create a repo with the bug condition. That way, we know exactly and narrowly what sort of history graph produces the bug. I think I have almost enough information here to do that, but you're welcome to try writing an MWE yourself.

Show 7 quoted lines
> 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)
> ```

Just to verify: in this example, is commit M a normal merge commit? Or is it also created with subtree?

Colin
Previous: george@mail.dietrich.pubNext: george@mail.dietrich.pub
Message 3 of 11 in “[Bug] Git subtree regression”
  1. dev@dietrich.pubDec 26, 2025
  2. george@mail.dietrich.pubDec 30, 2025
  3. Colin StagnerJan 4, 2026
  4. george@mail.dietrich.pubJan 4, 2026
  5. Colin StagnerJan 5, 2026
  6. george@mail.dietrich.pubJan 6, 2026
  7. Colin StagnerJan 10, 2026
  8. george@mail.dietrich.pubJan 10, 2026
  9. Colin StagnerFeb 15, 2026
  10. D. Ben KnobleFeb 16, 2026
  11. george@mail.dietrich.pubFeb 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.