Git development
 help / color / mirror / Atom feed
From: Colin Stagner <ask+git@howdoi.land>
To: george@mail.dietrich.pub
Cc: git@vger.kernel.org
Subject: Re: [Bug] Git subtree regression
Date: Sat, 3 Jan 2026 22:52:46 -0600	[thread overview]
Message-ID: <e25b4d76-c1b5-4b6b-ba77-e1e2f7243ce9@howdoi.land> (raw)
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.

> 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



  reply	other threads:[~2026-01-04  4:53 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
2026-01-04  4:52   ` Colin Stagner [this message]
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=e25b4d76-c1b5-4b6b-ba77-e1e2f7243ce9@howdoi.land \
    --to=ask+git@howdoi.land \
    --cc=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