File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ pick_one_preserving_merges () {
339
339
# No point in merging the first parent, that's HEAD
340
340
new_parents=${new_parents# $first_parent }
341
341
if ! do_with_author output \
342
- git merge $STRATEGY -m " $msg " $new_parents
342
+ git merge --no-ff $STRATEGY -m " $msg " $new_parents
343
343
then
344
344
printf " %s\n" " $msg " > " $GIT_DIR " /MERGE_MSG
345
345
die_with_patch $sha1 " Error redoing merge $sha1 "
Original file line number Diff line number Diff line change @@ -27,7 +27,17 @@ export GIT_AUTHOR_EMAIL
27
27
# \
28
28
# B2 <-- origin/topic
29
29
#
30
- # In both cases, 'topic' is rebased onto 'origin/topic'.
30
+ # Clone 3 (no-ff merge):
31
+ #
32
+ # A1--A2--B3 <-- origin/master
33
+ # \
34
+ # B1------M <-- topic
35
+ # \ /
36
+ # \--A3 <-- topic2
37
+ # \
38
+ # B2 <-- origin/topic
39
+ #
40
+ # In all cases, 'topic' is rebased onto 'origin/topic'.
31
41
32
42
test_expect_success ' setup for merge-preserving rebase' \
33
43
' echo First > A &&
@@ -61,6 +71,16 @@ test_expect_success 'setup for merge-preserving rebase' \
61
71
git commit -m "Merge origin/master into topic"
62
72
) &&
63
73
74
+ git clone ./. clone3 &&
75
+ (
76
+ cd clone3 &&
77
+ git checkout -b topic2 origin/topic &&
78
+ echo Sixth > A &&
79
+ git commit -a -m "Modify A3" &&
80
+ git checkout -b topic origin/topic &&
81
+ git merge --no-ff topic2
82
+ ) &&
83
+
64
84
git checkout topic &&
65
85
echo Fourth >> B &&
66
86
git commit -a -m "Modify B2"
@@ -93,4 +113,14 @@ test_expect_success '--continue works after a conflict' '
93
113
)
94
114
'
95
115
116
+ test_expect_success ' rebase -p preserves no-ff merges' '
117
+ (
118
+ cd clone3 &&
119
+ git fetch &&
120
+ git rebase -p origin/topic &&
121
+ test 3 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
122
+ test 1 = $(git rev-list --all --pretty=oneline | grep "Merge branch" | wc -l)
123
+ )
124
+ '
125
+
96
126
test_done
You can’t perform that action at this time.
0 commit comments