Code

Merge branch 'maint'
[git.git] / t / t3409-rebase-preserve-merges.sh
1 #!/bin/sh
2 #
3 # Copyright(C) 2008 Stephen Habermann & Andreas Ericsson
4 #
5 test_description='git rebase -p should preserve merges
7 Run "git rebase -p" and check that merges are properly carried along
8 '
9 . ./test-lib.sh
11 GIT_AUTHOR_EMAIL=bogus_email_address
12 export GIT_AUTHOR_EMAIL
14 #echo 'Setting up:
15 #
16 #A1--A2  <-- origin/master
17 # \   \
18 #  B1--M  <-- topic
19 #   \
20 #    B2  <-- origin/topic
21 #
22 #'
24 test_expect_success 'setup for merge-preserving rebase' \
25         'echo First > A &&
26         git add A &&
27         git-commit -m "Add A1" &&
28         git checkout -b topic &&
29         echo Second > B &&
30         git add B &&
31         git-commit -m "Add B1" &&
32         git checkout -f master &&
33         echo Third >> A &&
34         git-commit -a -m "Modify A2" &&
36         git clone ./. clone1 &&
37         cd clone1 &&
38         git checkout -b topic origin/topic &&
39         git merge origin/master &&
40         cd ..
42         git clone ./. clone2
43         cd clone2 &&
44         git checkout -b topic origin/topic &&
45         git merge origin/master &&
46         cd .. &&
48         git checkout topic &&
49         echo Fourth >> B &&
50         git commit -a -m "Modify B2"
51 '
53 test_expect_success 'rebase -p fakes interactive rebase' '
54         cd clone2 &&
55         git fetch &&
56         git rebase -p origin/topic &&
57         test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
58         test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
59 '
61 test_done