diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2022-04-21 07:42:33 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-21 19:35:45 +0300 |
commit | 9e5ebe9668a0f152757182b80bae9b66aad11952 (patch) | |
tree | b56ecd11d2a5995b00c8050bb2ad419567849969 /t/t3416-rebase-onto-threedots.sh | |
parent | 6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e (diff) |
rebase: use correct base for --keep-base when a branch is given
--keep-base rebases onto the merge base of the given upstream and the
current HEAD regardless of whether a branch is given. This is contrary
to the documentation and to the option's intended purpose. Instead,
rebase onto the merge base of the given upstream and the given branch.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3416-rebase-onto-threedots.sh')
-rwxr-xr-x | t/t3416-rebase-onto-threedots.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t3416-rebase-onto-threedots.sh b/t/t3416-rebase-onto-threedots.sh index 3716a42e81..3e04802cb0 100755 --- a/t/t3416-rebase-onto-threedots.sh +++ b/t/t3416-rebase-onto-threedots.sh @@ -129,6 +129,20 @@ test_expect_success 'rebase --keep-base main from topic' ' test_cmp expect actual ' +test_expect_success 'rebase --keep-base main topic from main' ' + git checkout main && + git branch -f topic G && + + git rebase --keep-base main topic && + git rev-parse C >base.expect && + git merge-base main HEAD >base.actual && + test_cmp base.expect base.actual && + + git rev-parse HEAD~2 >actual && + git rev-parse C^0 >expect && + test_cmp expect actual +' + test_expect_success 'rebase --keep-base main from side' ' git reset --hard && git checkout side && @@ -153,6 +167,21 @@ test_expect_success 'rebase -i --keep-base main from topic' ' test_cmp expect actual ' +test_expect_success 'rebase -i --keep-base main topic from main' ' + git checkout main && + git branch -f topic G && + + set_fake_editor && + EXPECT_COUNT=2 git rebase -i --keep-base main topic && + git rev-parse C >base.expect && + git merge-base main HEAD >base.actual && + test_cmp base.expect base.actual && + + git rev-parse HEAD~2 >actual && + git rev-parse C^0 >expect && + test_cmp expect actual +' + test_expect_success 'rebase -i --keep-base main from side' ' git reset --hard && git checkout side && |