Merge branch 'js/rebase-orig-head-fix'
[gitweb.git] / t / t3400-rebase.sh
index 3996ee013563ce1f91b2a693318b1e07aba96568..460d0523be6f35e4477a010edd365c1f8fbd431c 100755 (executable)
@@ -59,6 +59,14 @@ test_expect_success 'rebase against master' '
        git rebase master
 '
 
+test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '
+       git checkout -b orig-head topic &&
+       pre="$(git rev-parse --verify HEAD)" &&
+       git rebase master &&
+       test_cmp_rev "$pre" ORIG_HEAD &&
+       ! test_cmp_rev "$pre" HEAD
+'
+
 test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
        test_when_finished "git branch -D torebase" &&
        git checkout -b torebase my-topic-branch^ &&
@@ -183,13 +191,13 @@ test_expect_success 'cherry-picked commits and fork-point work together' '
        test_commit final_B B "Final B" &&
        git rebase &&
        echo Amended >expect &&
-       test_cmp A expect &&
+       test_cmp expect A &&
        echo "Final B" >expect &&
-       test_cmp B expect &&
+       test_cmp expect B &&
        echo C >expect &&
-       test_cmp C expect &&
+       test_cmp expect C &&
        echo D >expect &&
-       test_cmp D expect
+       test_cmp expect D
 '
 
 test_expect_success 'rebase -q is quiet' '