diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2022-10-17 15:17:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-17 20:53:03 +0200 |
commit | ce5238a690821d1de230091dd6c9c13a99ed6752 (patch) | |
tree | 41fd3107108a93cd90c4a5d82f8bef65df5c7930 /t/t3416-rebase-onto-threedots.sh | |
parent | rebase: factor out branch_base calculation (diff) | |
download | git-ce5238a690821d1de230091dd6c9c13a99ed6752.tar.xz git-ce5238a690821d1de230091dd6c9c13a99ed6752.zip |
rebase --keep-base: imply --reapply-cherry-picks
As --keep-base does not rebase the branch it is confusing if it
removes commits that have been cherry-picked to the upstream branch.
As --reapply-cherry-picks is not supported by the "apply" backend this
commit ensures that cherry-picks are reapplied by forcing the upstream
commit to match the onto commit unless --no-reapply-cherry-picks is
given.
Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t3416-rebase-onto-threedots.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t3416-rebase-onto-threedots.sh b/t/t3416-rebase-onto-threedots.sh index 01eb9513d6..ea501f2b42 100755 --- a/t/t3416-rebase-onto-threedots.sh +++ b/t/t3416-rebase-onto-threedots.sh @@ -199,6 +199,27 @@ test_expect_success 'rebase --keep-base requires a single merge base' ' grep "need exactly one merge base with branch" err ' +test_expect_success 'rebase --keep-base keeps cherry picks' ' + git checkout -f -B main E && + git cherry-pick F && + ( + set_fake_editor && + EXPECT_COUNT=2 git rebase -i --keep-base HEAD G + ) && + test_cmp_rev HEAD G +' + +test_expect_success 'rebase --keep-base --no-reapply-cherry-picks' ' + git checkout -f -B main E && + git cherry-pick F && + ( + set_fake_editor && + EXPECT_COUNT=1 git rebase -i --keep-base \ + --no-reapply-cherry-picks HEAD G + ) && + test_cmp_rev HEAD^ C +' + # This must be the last test in this file test_expect_success '$EDITOR and friends are unchanged' ' test_editor_unchanged |