Skip to content

Commit hashes different between splitsh-lite and git subtree split #65

@Blacksmoke16

Description

@Blacksmoke16

I ran into an issue where the hashes are different between this lib and a standard subtree split. This is causing issues when trying to push the changes to a child repos, while using git subtree push works fine.

$ git version
git version 2.34.1

$ splitsh-lite --version
splitsh-lite version v1.0.1

This issue can be reproduced via this script using https://github.com/crystal-manyrepos/two (but also reproduces when using this repo for example):

mkdir mono
cd mono/
git init
touch README.md
git add -A
git commit -m "Initialize mono repo"

git subtree add --prefix=libs/two/ git@github.com:crystal-manyrepos/two.git master

splitsh-lite --scratch --prefix=libs/two && git subtree split --prefix=libs/two

More details below, but it seems like splitsh isn't gathering all the expected commits which results in the hash being different in the end. I'm not using --squash so I don't think it's related to #15. I actually also tried with that Docker image in that issue and same problem.

Output:

Details
Initialized empty Git repository in /home/george/dev/git/crystal-many/mono/.git/
[master (root-commit) 1a613f0] Initialize mono repo
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
git fetch git@github.com:crystal-manyrepos/two.git master
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 20 (delta 3), reused 19 (delta 2), pack-reused 0
Unpacking objects: 100% (20/20), 4.01 KiB | 373.00 KiB/s, done.
From github.com:crystal-manyrepos/two
* branch            master     -> FETCH_HEAD
Added dir 'libs/two'
1 commits created, 5 commits traversed, in 6ms
c8f28643a1f9cb160a075e1672addd1a30d63d6b
88ce77827ecd614fcca6e2bbb6983999daab2367

Debug output:

Details
$ splitsh-lite --prefix=libs/two/ --scratch --debug
2021/12/12 10:25:17 Splitting refs/heads/master
2021/12/12 10:25:17   From "libs/two/" to "ROOT"
2021/12/12 10:25:17 Processing commit: 1a613f0abf4fd5ce57a6d7ec2c9e70bef0c61127
2021/12/12 10:25:17   parents:
2021/12/12 10:25:17   newparents:
2021/12/12 10:25:17 Processing commit: 6e5fa9f03d5350ebee79b6899de1072a3dd126e9
2021/12/12 10:25:17   parents:
2021/12/12 10:25:17   newparents:
2021/12/12 10:25:17 Processing commit: 686027d84b670d9fa7861fe9b16c24a79428a2d4
2021/12/12 10:25:17   parents: 6e5fa9f03d5350ebee79b6899de1072a3dd126e9
2021/12/12 10:25:17   newparents:
2021/12/12 10:25:17 Processing commit: 88ce77827ecd614fcca6e2bbb6983999daab2367
2021/12/12 10:25:17   parents: 686027d84b670d9fa7861fe9b16c24a79428a2d4
2021/12/12 10:25:17   newparents:
2021/12/12 10:25:17 Processing commit: 868052990df6cddf09cc35c4bcbf63c4ade5c66c
2021/12/12 10:25:17   parents: 1a613f0abf4fd5ce57a6d7ec2c9e70bef0c61127 88ce77827ecd614fcca6e2bbb6983999daab2367
2021/12/12 10:25:17   newparents:
2021/12/12 10:25:17   tree is: 774bd095bf0c560acd754e6351f389fe2d1451f0
2021/12/12 10:25:17   copy commit "868052990df6cddf09cc35c4bcbf63c4ade5c66c" "774bd095bf0c560acd754e6351f389fe2d1451f0" ""
2021/12/12 10:25:17   newrev is: c8f28643a1f9cb160a075e1672addd1a30d63d6b
1 commits created, 5 commits traversed, in 4ms
c8f28643a1f9cb160a075e1672addd1a30d63d6b

Git log (master):

Details
$ git log
commit 868052990df6cddf09cc35c4bcbf63c4ade5c66c (HEAD -> master)
Merge: 1a613f0 88ce778
Author: George Dietrich <george@dietrich.app>
Date:   Sun Dec 12 10:24:46 2021 -0500

Add 'libs/two/' from commit '88ce77827ecd614fcca6e2bbb6983999daab2367'

git-subtree-dir: libs/two
git-subtree-mainline: 1a613f0abf4fd5ce57a6d7ec2c9e70bef0c61127
git-subtree-split: 88ce77827ecd614fcca6e2bbb6983999daab2367

commit 1a613f0abf4fd5ce57a6d7ec2c9e70bef0c61127
Author: George Dietrich <george@dietrich.app>
Date:   Sun Dec 12 10:24:45 2021 -0500

Initialize mono repo

commit 88ce77827ecd614fcca6e2bbb6983999daab2367
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 23:19:21 2021 -0500

Bump component versions

commit 686027d84b670d9fa7861fe9b16c24a79428a2d4
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 22:39:52 2021 -0500

Add .summary method

commit 6e5fa9f03d5350ebee79b6899de1072a3dd126e9
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 22:39:10 2021 -0500

Initial commit

Git log, branch created via splitsh:

Details
$ splitsh-lite --prefix=libs/two/ --scratch --target=refs/heads/splitsh
1 commits created, 5 commits traversed, in 6ms
c8f28643a1f9cb160a075e1672addd1a30d63d6b

$ git co splitsh

$ git log
commit c8f28643a1f9cb160a075e1672addd1a30d63d6b (HEAD -> splitsh)
Author: George Dietrich <george@dietrich.app>
Date:   Sun Dec 12 10:24:46 2021 -0500

Add 'libs/two/' from commit '88ce77827ecd614fcca6e2bbb6983999daab2367'

git-subtree-dir: libs/two
git-subtree-mainline: 1a613f0abf4fd5ce57a6d7ec2c9e70bef0c61127
git-subtree-split: 88ce77827ecd614fcca6e2bbb6983999daab2367

Git log, branch created via subtree split:

Details
$ git subtree split -P libs/two -b subtree-split
Created branch 'subtree-split'
88ce77827ecd614fcca6e2bbb6983999daab2367

$ git co subtree-split

$ git log
commit 88ce77827ecd614fcca6e2bbb6983999daab2367 (HEAD -> subtree-split)
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 23:19:21 2021 -0500

Bump component versions

commit 686027d84b670d9fa7861fe9b16c24a79428a2d4
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 22:39:52 2021 -0500

Add .summary method

commit 6e5fa9f03d5350ebee79b6899de1072a3dd126e9
Author: George Dietrich <george@dietrich.app>
Date:   Sat Dec 11 22:39:10 2021 -0500

Initial commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions