aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-13 10:45:21 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-13 10:45:21 -0700
commite31b0183729cab2d6a8e2c76f009017355dacf06 (patch)
treef76385fbc62c0bd508891c681594537f378fcf50
parentbc67ad8c375ce8f31021411f088a968f12cb2675 (diff)
parentc192f9c865dbdae48c0400d717581d34cd315fb8 (diff)
downloadgit-e31b0183729cab2d6a8e2c76f009017355dacf06.tar.gz
git-e31b0183729cab2d6a8e2c76f009017355dacf06.tar.xz
Merge branch 'aw/maint-rebase-i-p-no-ff' into maint
* aw/maint-rebase-i-p-no-ff: git-rebase--interactive.sh: preserve-merges fails on merges created with no-ff
-rwxr-xr-xgit-rebase--interactive.sh2
-rwxr-xr-xt/t3409-rebase-preserve-merges.sh32
2 files changed, 32 insertions, 2 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 5873ba4bc..c308529a9 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -339,7 +339,7 @@ pick_one_preserving_merges () {
# No point in merging the first parent, that's HEAD
new_parents=${new_parents# $first_parent}
if ! do_with_author output \
- git merge $STRATEGY -m "$msg" $new_parents
+ git merge --no-ff $STRATEGY -m "$msg" $new_parents
then
printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG
die_with_patch $sha1 "Error redoing merge $sha1"
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index 19341e5ca..08201e233 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 &&
@@ -61,6 +71,16 @@ test_expect_success 'setup for merge-preserving rebase' \
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 &&
git commit -a -m "Modify B2"
@@ -93,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