wt-status.c: set commitable bit if there is a meaningful merge.
[gitweb.git] / t / t3402-rebase-merge.sh
index 0779aaa9aba16f0f8502505b4df5cc49cfe8af82..5a27ec9b5eb7c37145a098d878432948233ba756 100755 (executable)
@@ -33,6 +33,7 @@ test_expect_success setup '
        tr "[a-z]" "[A-Z]" <original >newfile &&
        git add newfile &&
        git commit -a -m"side edits further." &&
+       git branch second-side &&
 
        tr "[a-m]" "[A-M]" <original >newfile &&
        rm -f original &&
@@ -41,6 +42,7 @@ test_expect_success setup '
        git branch test-rebase side &&
        git branch test-rebase-pick side &&
        git branch test-reference-pick side &&
+       git branch test-conflicts side &&
        git checkout -b test-merge side
 '
 
@@ -48,9 +50,14 @@ test_expect_success 'reference merge' '
        git merge -s recursive "reference merge" HEAD master
 '
 
+PRE_REBASE=$(git rev-parse test-rebase)
 test_expect_success rebase '
        git checkout test-rebase &&
-       git rebase --merge master
+       GIT_TRACE=1 git rebase --merge master
+'
+
+test_expect_success 'test-rebase@{1} is pre rebase' '
+       test $PRE_REBASE = $(git rev-parse test-rebase@{1})
 '
 
 test_expect_success 'merge and rebase should match' '
@@ -69,6 +76,15 @@ test_expect_success 'rebase the other way' '
        git rebase --merge side
 '
 
+test_expect_success 'rebase -Xtheirs' '
+       git checkout -b conflicting master~2 &&
+       echo "AB $T" >> original &&
+       git commit -mconflicting original &&
+       git rebase -Xtheirs master &&
+       grep AB original &&
+       ! grep 11 original
+'
+
 test_expect_success 'merge and rebase should match' '
        git diff-tree -r test-rebase test-merge >difference &&
        if test -s difference
@@ -103,4 +119,38 @@ test_expect_success 'picking rebase' '
        esac
 '
 
+test_expect_success 'rebase -s funny -Xopt' '
+       test_when_finished "rm -fr test-bin funny.was.run" &&
+       mkdir test-bin &&
+       cat >test-bin/git-merge-funny <<-EOF &&
+       #!$SHELL_PATH
+       case "\$1" in --opt) ;; *) exit 2 ;; esac
+       shift &&
+       >funny.was.run &&
+       exec git merge-recursive "\$@"
+       EOF
+       chmod +x test-bin/git-merge-funny &&
+       git reset --hard &&
+       git checkout -b test-funny master^ &&
+       test_commit funny &&
+       (
+               PATH=./test-bin:$PATH
+               git rebase -s funny -Xopt master
+       ) &&
+       test -f funny.was.run
+'
+
+test_expect_success 'rebase --skip works with two conflicts in a row' '
+       git checkout second-side  &&
+       tr "[A-Z]" "[a-z]" <newfile >tmp &&
+       mv tmp newfile &&
+       git commit -a -m"edit conflicting with side" &&
+       tr "[d-f]" "[D-F]" <newfile >tmp &&
+       mv tmp newfile &&
+       git commit -a -m"another edit conflicting with side" &&
+       test_must_fail git rebase --merge test-conflicts &&
+       test_must_fail git rebase --skip &&
+       git rebase --skip
+'
+
 test_done