3 test_description
='git rebase --abort tests'
7 ### Test that we handle space characters properly
8 work_dir
="$(pwd)/test dir"
10 test_expect_success setup
'
11 mkdir -p "$work_dir" &&
17 git branch to-rebase &&
24 git checkout to-rebase &&
26 git commit -a -m "merge should fail on this" &&
28 git commit -a -m "merge should fail on this, too" &&
36 test_expect_success
"rebase$type --abort" '
38 # Clean up the state from the previous one
39 git reset --hard pre-rebase &&
40 test_must_fail git rebase$type master &&
41 test_path_is_dir "$dotest" &&
43 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
47 test_expect_success
"rebase$type --abort after --skip" '
49 # Clean up the state from the previous one
50 git reset --hard pre-rebase &&
51 test_must_fail git rebase$type master &&
52 test_path_is_dir "$dotest" &&
53 test_must_fail git rebase --skip &&
54 test $(git rev-parse HEAD) = $(git rev-parse master) &&
56 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
60 test_expect_success
"rebase$type --abort after --continue" '
62 # Clean up the state from the previous one
63 git reset --hard pre-rebase &&
64 test_must_fail git rebase$type master &&
65 test_path_is_dir "$dotest" &&
69 test_must_fail git rebase --continue &&
70 test $(git rev-parse HEAD) != $(git rev-parse master) &&
72 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
76 test_expect_success
"rebase$type --abort does not update reflog" '
78 # Clean up the state from the previous one
79 git reset --hard pre-rebase &&
80 git reflog show to-rebase > reflog_before &&
81 test_must_fail git rebase$type master &&
83 git reflog show to-rebase > reflog_after &&
84 test_cmp reflog_before reflog_after &&
85 rm reflog_before reflog_after
88 test_expect_success
'rebase --abort can not be used with other options' '
90 # Clean up the state from the previous one
91 git reset --hard pre-rebase &&
92 test_must_fail git rebase$type master &&
93 test_must_fail git rebase -v --abort &&
94 test_must_fail git rebase --abort -v &&
99 testrebase
" --apply" .git
/rebase-apply
100 testrebase
" --merge" .git
/rebase-merge
102 test_expect_success
'rebase --apply --quit' '
104 # Clean up the state from the previous one
105 git reset --hard pre-rebase &&
106 test_must_fail git rebase --apply master &&
107 test_path_is_dir .git/rebase-apply &&
108 head_before=$(git rev-parse HEAD) &&
110 test $(git rev-parse HEAD) = $head_before &&
111 test ! -d .git/rebase-apply
114 test_expect_success
'rebase --merge --quit' '
116 # Clean up the state from the previous one
117 git reset --hard pre-rebase &&
118 test_must_fail git rebase --merge master &&
119 test_path_is_dir .git/rebase-merge &&
120 head_before=$(git rev-parse HEAD) &&
122 test $(git rev-parse HEAD) = $head_before &&
123 test ! -d .git/rebase-merge