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

Re: [PATCH 3/3] contrib/subtree: process out-of-prefix subtrees

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Feb 16, 2026, 21:33 UTC
Message-ID
<CALnO6CAK1-+MpvjjPFUCeOEbDQn+R8EG7E8bmHo1XYt_ZMQpCg@mail.gmail.com>
In-Reply-To
<20260215201906.889951-4-ask+git@howdoi.land>
On Mon, Feb 16, 2026 at 4:16 PM Colin Stagner <ask+git@howdoi.land> wrote:
Show 45 quoted lines
>
> `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]: <20251230170719.845029-1-george@mail.dietrich.pub>
>
> Reported-by: George <george@mail.dietrich.pub>
>
> Reported-by: Christian Heusel <christian@heusel.eu>
>
> Signed-off-by: Colin Stagner <ask+git@howdoi.land>

nit: "git interpret-trailers --parse" doesn't understand line-separated trailers, so only finds the SoB line. See git-interpret-trailers(1).

(A useful test locally was something like
    b4 am https://lore.kernel.org/git/20260215201906.889951-4-ask+git@howdoi.land/
    git mailsplit -op
20260215_ask_git_contrib_subtree_process_out_of_prefix_subtrees.mbx
    git interpret-trailers --parse p/0003
which output only
    Signed-off-by: Colin Stagner <ask+git@howdoi.land>
which I don't think you intended.)
-- 
D. Ben Knoble
Previous: Colin StagnerNext: Colin Stagner
Message 4 of 6 in “contrib/subtree: process out-of-prefix subtrees”
  1. 0/3 contrib/subtree: process out-of-prefix subtreesColin Stagner, Feb 15, 2026
  2. 1/3 contrib/subtree: capture additional test-casesColin Stagner, Feb 15, 2026
  3. 3/3 contrib/subtree: process out-of-prefix subtreesColin Stagner, Feb 15, 2026
  4. D. Ben KnobleFeb 16, 2026
  5. Colin StagnerFeb 18, 2026
  6. 2/3 contrib/subtree: test history depthColin Stagner, Feb 15, 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.