Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Blacksmoke16 opened this issue Dec 12, 2021 · 1 comment
Open

Comments

@Blacksmoke16
Copy link

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:

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:

$ 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):

$ 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:

$ 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:

$ 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
@kdambekalns
Copy link
Contributor

Looking at using this (again), and still seeing differences in the hashes. The discussion in #26 indicates the differences are nothing to worry about, eventually.

In case it helps with debugging, here is a screenshot showing where things (start to) differ in my testcase. For this I split the 8.2 branch of https://github.com/neos/flow-development-collection into https://github.com/kdambekalns/flow/tree/8.2-splitsh.

git-difference-splitsh-lite

At point (1) the branches have the same "root", up to that point they are identical. Point (2) shows the first commits being different in both branches - the "same" PR being merged. In point (3) the PR branch (red) shows a difference, the merge of neos/flow-development-collection#1919 is missing in the splitsh-lite split…

Here is the original history bit:

git-original-history

One merge commit for neos/flow-development-collection#1917 clearly having the merge of neos/flow-development-collection#1919. The latter is actually empty (no code changes), so maybe it got "optimized away"? Or maybe the equivalent of git/git@dd65a9e#diff-59f70cbe935ec223e3df413b94cab740 (as mentioned in #26)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants