View Issue Details

IDProjectCategoryView StatusLast Update
0010660Rocky-Linux-9gitpublic2025-09-18 03:53
ReporterColin S Assigned To 
PrioritylowSeveritytrivialReproducibilityalways
Status newResolutionopen 
Platformx86_64OSRockyOS Version9.6
Summary0010660: git-subtree: fix split with squashed subtrees
DescriptionThe git-subtree that is distributed with git v2.44 through v2.51 does not correctly split subtrees that contain squashed merges. For

    git subtree split -P somedir

if the history of somedir also contains squashed subtree merges, the split history may be incomplete.

I have corrected this defect by submitting a patch to the Git project, which was accepted and merged into next. See:
<https://git.kernel.org/pub/scm/git/git.git/commit/?h=next&id=83f9dad7d6fb5988b68f80b25bd87c68693195dd>.

Is it possible to include this patch in Rocky?
Steps To Reproduce```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)"
```

This should look 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.
Tagspatch

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-09-18 03:53 Colin S New Issue
2025-09-18 03:53 Colin S Tag Attached: patch