Add test for git rebase --abort
[git/mingw/4msysgit.git] / t / t3407-rebase-abort.sh
blob94bdd723306c7795c8a17095bad0925b662345d4
1 #!/bin/sh
3 test_description='git rebase --abort tests'
5 . ./test-lib.sh
7 test_expect_success setup '
8 echo a > a &&
9 git add a &&
10 git commit -m a &&
11 git branch to-rebase &&
13 echo b > a &&
14 git commit -a -m b &&
15 echo c > a &&
16 git commit -a -m c &&
18 git checkout to-rebase &&
19 echo d > a &&
20 git commit -a -m "merge should fail on this" &&
21 echo e > a &&
22 git commit -a -m "merge should fail on this, too" &&
23 git branch pre-rebase
26 test_expect_success 'rebase --abort' '
27 test_must_fail git rebase master &&
28 git rebase --abort &&
29 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
32 test_expect_failure 'rebase --abort after --skip' '
33 # Clean up the state from the previous one
34 git reset --hard pre-rebase
35 rm -rf .dotest
37 test_must_fail git rebase master &&
38 test_must_fail git rebase --skip &&
39 test $(git rev-parse HEAD) = $(git rev-parse master) &&
40 git rebase --abort &&
41 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
44 test_expect_success 'rebase --abort after --continue' '
45 # Clean up the state from the previous one
46 git reset --hard pre-rebase
47 rm -rf .dotest
49 test_must_fail git rebase master &&
50 echo c > a &&
51 echo d >> a &&
52 git add a &&
53 test_must_fail git rebase --continue &&
54 test $(git rev-parse HEAD) != $(git rev-parse master) &&
55 git rebase --abort &&
56 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
59 test_done