@@ -11,15 +11,23 @@ Run "git rebase -p" and check that merges are properly carried along
11
11
GIT_AUTHOR_EMAIL=bogus_email_address
12
12
export GIT_AUTHOR_EMAIL
13
13
14
- #echo 'Setting up :
14
+ # Clone 1 (trivial merge) :
15
15
#
16
- #A1--A2 <-- origin/master
17
- # \ \
18
- # B1--M <-- topic
19
- # \
20
- # B2 <-- origin/topic
16
+ # A1--A2 <-- origin/master
17
+ # \ \
18
+ # B1--M <-- topic
19
+ # \
20
+ # B2 <-- origin/topic
21
21
#
22
- #'
22
+ # Clone 2 (conflicting merge):
23
+ #
24
+ # A1--A2--B3 <-- origin/master
25
+ # \ \
26
+ # B1------M <-- topic
27
+ # \
28
+ # B2 <-- origin/topic
29
+ #
30
+ # In both cases, 'topic' is rebased onto 'origin/topic'.
23
31
24
32
test_expect_success 'setup for merge-preserving rebase' \
25
33
'echo First > A &&
@@ -37,12 +45,19 @@ test_expect_success 'setup for merge-preserving rebase' \
37
45
cd clone1 &&
38
46
git checkout -b topic origin/topic &&
39
47
git merge origin/master &&
40
- cd ..
48
+ cd .. &&
49
+
50
+ echo Fifth > B &&
51
+ git add B &&
52
+ git commit -m "Add different B" &&
41
53
42
- git clone ./. clone2
54
+ git clone ./. clone2 &&
43
55
cd clone2 &&
44
56
git checkout -b topic origin/topic &&
45
- git merge origin/master &&
57
+ test_must_fail git merge origin/master &&
58
+ echo Resolved > B &&
59
+ git add B &&
60
+ git commit -m "Merge origin/master into topic" &&
46
61
cd .. &&
47
62
48
63
git checkout topic &&
@@ -51,11 +66,30 @@ test_expect_success 'setup for merge-preserving rebase' \
51
66
'
52
67
53
68
test_expect_success 'rebase -p fakes interactive rebase' '
54
- cd clone2 &&
69
+ (
70
+ cd clone1 &&
55
71
git fetch &&
56
72
git rebase -p origin/topic &&
57
73
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
58
74
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
75
+ )
76
+ '
77
+
78
+ test_expect_success '--continue works after a conflict' '
79
+ (
80
+ cd clone2 &&
81
+ git fetch &&
82
+ test_must_fail git rebase -p origin/topic &&
83
+ test 2 = $(git ls-files B | wc -l) &&
84
+ echo Resolved again > B &&
85
+ test_must_fail git rebase --continue &&
86
+ grep "^@@@ " .git/rebase-merge/patch &&
87
+ git add B &&
88
+ git rebase --continue &&
89
+ test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
90
+ test 1 = $(git rev-list --all --pretty=oneline | grep "Add different" | wc -l) &&
91
+ test 1 = $(git rev-list --all --pretty=oneline | grep "Merge origin" | wc -l)
92
+ )
59
93
'
60
94
61
95
test_done
0 commit comments