Handle multiple base revisions between the parents we're examining.
authorStephen Haberman <stephen@exigencecorp.com>
Thu, 24 Jul 2008 06:11:37 +0000 (01:11 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Thu, 24 Jul 2008 06:11:37 +0000 (01:11 -0500)
tests/t2301-server-update-prefer-rebase-even-if-merges.sh

index 1f3cb20..470cb1c 100644 (file)
@@ -62,5 +62,61 @@ test_expect_success 'merging in stable does not fool the script' '
        cat push.err | grep "It looks like you should rebase instead of merging"
 '
 
+#
+# A --C------            stable
+#  \  |      \
+#   B -- D -- E -- F     topic2
+#    \|             \
+#     G -- H ------- I   attempted push
+#
+# Trying to push F..I
+#
+# merge-base(F, H) has two options: B and C
+#
+test_expect_success 'merging in stable with tricky double baserev does not fool the script' '
+       # start our branch, and share it--commit B
+       git checkout -b topic2 stable &&
+       git config --add branch.topic2.remote origin &&
+       git config --add branch.topic2.merge refs/heads/topic2 &&
+       echo "commit B" >a.topic2 &&
+       git add a.topic2 &&
+       git commit -m "commit B created topic2" &&
+       git push origin topic2 &&
+
+       # now, separately, move ahead stable, and share it--commit C
+       git checkout stable
+       echo "commit C" >a &&
+       git commit -a -m "commit C moved stable" &&
+       git push origin stable &&
+
+       # have another client commit (in this case, it is the server, but close enough) moves topic2
+       cd server &&
+       git checkout topic2 &&
+       echo "commit D continuing topic2" >a.client2 &&
+       git add a.client2 &&
+       git commit -m "commit D by client2" &&
+
+       # Go ahead and merge in stable by the other client--commit E
+       git merge stable &&
+
+       # Then move topic2 put to--commit F
+       echo "commit F" >a.client2 &&
+       git commit -a -m "commit F by client2" &&
+       cd .. &&
+
+       # now locally try and merge in stable (even though we are out of date)--commit G
+       git checkout topic2 &&
+       git merge stable &&
+
+       # Go ahead and move our local topic2
+       echo "commit H" >a.topic2 &&
+       git commit -a -m "commit H continues local fork" &&
+
+       # Make a new merge commit
+       git pull &&
+       ! git push origin topic2
+       cat push.err | grep "It looks like you should rebase instead of merging"
+'
+
 test_done