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

subtree: [v2.44 regression] split may produce different history

From
CSColin Stagner <ask+git@howdoi.land>
Date
Aug 21, 2025, 03:13 UTC
Message-ID
<c9e8f54f-2594-4092-ae41-f1da73e97f6e@howdoi.land>
In-Reply-To
<pull.1587.v6.git.1701442494319.gitgitgadget@gmail.com>

98ba49ccc247 likely introduces a regression in "git subtree split" [1] [2]. For some inputs, the split history is incomplete and does not match previous git versions.

For
     git subtree split -P somedir

if the history of `somedir` also contains *squashed* subtree *merges*, the split history may be incomplete. MWE follows:

```bash git init mwe && cd mwe

# create history we will subtree merge later git checkout --orphan deeper touch two_deep && git add two_deep git commit -m 'deeper: a nested subtree'

# create top-level project history with one # subproject in a directory sub/ git checkout --orphan main git reset --hard echo 'A test for git-subtree'>README.txt mkdir sub && touch sub/README.sub.txt git add . git commit -m 'Initial commit'

# add "deeper" branch as sub/deeper # the --squash is important here since it omits # "git-subtree-mainline:", which 98ba49ccc247 # looks for in `should_ignore_subtree_split_commit()` git subtree add --squash -P sub/deeper deeper ```

Now `git ls-tree --name-only -r main` looks like this:
     README.txt
     sub/README.sub.txt
     sub/deeper/two_deep
We can split `sub` off as its own top-level history.
```bash
git ls-tree -r --name-only -- \
   "$(git subtree.sh split -P sub)"
```
Before the patch, that looks like:
     README.sub.txt
     deeper/two_deep
Which is correct. After the patch, there is only:
     README.sub.txt

which is missing the entire `deeper/` directory. (The hash output from `split` is also different.)

I suspect the test in `should_ignore_subtree_split_commit ()` inadvertently rejects commits that should be kept.

I tested with Git binaries from v2.43 on Ubuntu [3].

[1]: https://git.kernel.org/pub/scm/git/git.git/commit/?id=98ba49ccc247c3521659aa3d43c970e8978922c5

[2]: https://lore.kernel.org/all/pull.1587.v6.git.1701442494319.gitgitgadget@gmail.com/

[3]: http://archive.ubuntu.com/ubuntu/pool/main/g/git/git_2.43.0-1ubuntu7.3_amd64.deb

Previous: Junio C Hamano
Message 30 of 30 in “subtree: fix split processing with multiple subtrees present”
  1. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 18, 2023
  2. Junio C HamanoSep 18, 2023
  3. Junio C HamanoSep 19, 2023
  4. Zach FettersMooreOct 26, 2023
  5. 0/2 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 22, 2023
  6. 2/2 subtree: changing location of commit ignore processingZach FettersMoore via GitGitGadget, Sep 22, 2023
  7. 1/2 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 22, 2023
  8. 0/3 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 29, 2023
  9. 2/3 subtree: changing location of commit ignore processingZach FettersMoore via GitGitGadget, Sep 29, 2023
  10. 3/3 subtree: adding test to validate fixZach FettersMoore via GitGitGadget, Sep 29, 2023
  11. 1/3 subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Sep 29, 2023
  12. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Oct 26, 2023
  13. Christian CouderNov 18, 2023
  14. Zach FettersMooreNov 28, 2023
  15. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Nov 28, 2023
  16. Christian CouderNov 30, 2023
  17. Zach FettersMooreNov 30, 2023
  18. subtree: fix split processing with multiple subtrees presentZach FettersMoore via GitGitGadget, Dec 1, 2023
  19. Christian CouderDec 4, 2023
  20. Zach FettersMooreDec 11, 2023
  21. Christian CouderDec 12, 2023
  22. Junio C HamanoDec 12, 2023
  23. Zach FettersMooreDec 13, 2023
  24. Christian CouderJan 3, 2024
  25. Christian CouderDec 20, 2023
  26. Christian CouderJan 25, 2024
  27. Junio C HamanoJan 25, 2024
  28. Christian CouderJan 25, 2024
  29. Junio C HamanoJan 25, 2024
  30. subtree: [v2.44 regression] split may produce different historyColin Stagner, Aug 21, 2025

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.