git-clean: add tests for relative path
[git/trast.git] / t / t3407-rebase-abort.sh
blob37944c39a3be5e8d2db59faa5609d857fe902199
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 testrebase() {
27 type=$1
28 dotest=$2
30 test_expect_success "rebase$type --abort" '
31 # Clean up the state from the previous one
32 git reset --hard pre-rebase
33 test_must_fail git rebase'"$type"' master &&
34 test -d '$dotest' &&
35 git rebase --abort &&
36 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
37 test ! -d '$dotest'
40 test_expect_success "rebase$type --abort after --skip" '
41 # Clean up the state from the previous one
42 git reset --hard pre-rebase
43 test_must_fail git rebase'"$type"' master &&
44 test -d '$dotest' &&
45 test_must_fail git rebase --skip &&
46 test $(git rev-parse HEAD) = $(git rev-parse master) &&
47 git-rebase --abort &&
48 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
49 test ! -d '$dotest'
52 test_expect_success "rebase$type --abort after --continue" '
53 # Clean up the state from the previous one
54 git reset --hard pre-rebase
55 test_must_fail git rebase'"$type"' master &&
56 test -d '$dotest' &&
57 echo c > a &&
58 echo d >> a &&
59 git add a &&
60 test_must_fail git rebase --continue &&
61 test $(git rev-parse HEAD) != $(git rev-parse master) &&
62 git rebase --abort &&
63 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
64 test ! -d '$dotest'
68 testrebase "" .dotest
69 testrebase " --merge" .git/.dotest-merge
71 test_done