Merge branch 'ah/rebase-keep-base-fix' into maint

"git rebase --keep-base <upstream> <branch-to-rebase>" computed the
commit to rebase onto incorrectly, which has been corrected.
source: <20220421044233.894255-1-alexhenrie24@gmail.com>

* ah/rebase-keep-base-fix:
  rebase: use correct base for --keep-base when a branch is given
This commit is contained in:
Junio C Hamano
2022-06-08 14:27:52 -07:00
3 changed files with 60 additions and 29 deletions

View File

@ -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 &&