diff options
Diffstat (limited to 't/t3409-rebase-preserve-merges.sh')
-rwxr-xr-x | t/t3409-rebase-preserve-merges.sh | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh index 8f785e7957..08201e2331 100755 --- a/t/t3409-rebase-preserve-merges.sh +++ b/t/t3409-rebase-preserve-merges.sh @@ -27,7 +27,17 @@ export GIT_AUTHOR_EMAIL # \ # B2 <-- origin/topic # -# In both cases, 'topic' is rebased onto 'origin/topic'. +# Clone 3 (no-ff merge): +# +# A1--A2--B3 <-- origin/master +# \ +# B1------M <-- topic +# \ / +# \--A3 <-- topic2 +# \ +# B2 <-- origin/topic +# +# In all cases, 'topic' is rebased onto 'origin/topic'. test_expect_success 'setup for merge-preserving rebase' \ 'echo First > A && @@ -42,23 +52,34 @@ test_expect_success 'setup for merge-preserving rebase' \ git commit -a -m "Modify A2" && git clone ./. clone1 && - cd clone1 && + (cd clone1 && git checkout -b topic origin/topic && - git merge origin/master && - cd .. && + git merge origin/master + ) && echo Fifth > B && git add B && git commit -m "Add different B" && git clone ./. clone2 && - cd clone2 && - git checkout -b topic origin/topic && - test_must_fail git merge origin/master && - echo Resolved > B && - git add B && - git commit -m "Merge origin/master into topic" && - cd .. && + ( + cd clone2 && + git checkout -b topic origin/topic && + test_must_fail git merge origin/master && + echo Resolved >B && + git add B && + git commit -m "Merge origin/master into topic" + ) && + + git clone ./. clone3 && + ( + cd clone3 && + git checkout -b topic2 origin/topic && + echo Sixth > A && + git commit -a -m "Modify A3" && + git checkout -b topic origin/topic && + git merge --no-ff topic2 + ) && git checkout topic && echo Fourth >> B && @@ -71,7 +92,7 @@ test_expect_success 'rebase -p fakes interactive rebase' ' git fetch && git rebase -p origin/topic && test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) && - test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote branch " | wc -l) + test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote-tracking branch " | wc -l) ) ' @@ -92,4 +113,14 @@ test_expect_success '--continue works after a conflict' ' ) ' +test_expect_success 'rebase -p preserves no-ff merges' ' + ( + cd clone3 && + git fetch && + git rebase -p origin/topic && + test 3 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) && + test 1 = $(git rev-list --all --pretty=oneline | grep "Merge branch" | wc -l) + ) +' + test_done |