gitext-rs / git-stack

Stacked branch management for Git
Apache License 2.0
491 stars 19 forks source link

Rebase does not move the branch being rebased #306

Open Kinrany opened 1 year ago

Kinrany commented 1 year ago

Creating a separate issue from https://github.com/gitext-rs/git-stack/issues/303

Repro: https://github.com/Kinrany/repro-git-stack

Originally the problem was that all branches were being moved onto a single commit. I think I understand that behavior now: all of the commits there were created with --allow-empty. Might make sense to add an exception for commits that are explicitly empty though?

With this new repro, there's another unexpected behavior. I'm moving main2 onto main. main includes all of the commits in main2, however there are other branches on top of main2. For some reason git stack --rebase --onto main moves all those other branches but not main2 itself.

epage commented 1 year ago

Originally the problem was that all branches were being moved onto a single commit. I think I understand that behavior now: all of the commits there were created with --allow-empty. Might make sense to add an exception for commits that are explicitly empty though?

Empty commits do not matter. If there is also a problem there, please open another issue.

When looking at #303, an issue I noticed is that our logic for updating to the latest commit of a remote was causing main to move to point to main2 which it shouldn't.

epage commented 1 year ago

With this new repro, there's another unexpected behavior. I'm moving main2 onto main. main includes all of the commits in main2, however there are other branches on top of main2. For some reason git stack --rebase --onto main moves all those other branches but not main2 itself.

One of two things is happening