t3404: stricter tests for git-rebase--interactive
Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stephan Beyer committed
Jun 22, 2008 at 01:55 UTC
ab7367929f69c8b0f2f59d89225f211253ff57ef
1 file changed
+34
-9
t/t3404-rebase-interactive.sh
+34
-9
@@ -96,6 +96,7 @@ chmod a+x fake-editor.sh
96
97
test_expect_success 'no changes are a nop' '
98
git rebase -i F &&
99
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
100
test $(git rev-parse I) = $(git rev-parse HEAD)
101
'
102
@@ -104,14 +105,26 @@ test_expect_success 'test the [branch] option' '
105
git rm file6 &&
106
git commit -m "stop here" &&
107
git rebase -i F branch2 &&
108
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
109
+ test $(git rev-parse I) = $(git rev-parse branch2) &&
110
test $(git rev-parse I) = $(git rev-parse HEAD)
111
'
112
113
+test_expect_success 'test --onto <branch>' '
114
+ git checkout -b test-onto branch2 &&
115
+ git rebase -i --onto branch1 F &&
116
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" &&
117
+ test $(git rev-parse HEAD^) = $(git rev-parse branch1) &&
118
+ test $(git rev-parse I) = $(git rev-parse branch2)
119
+'
120
+
121
test_expect_success 'rebase on top of a non-conflicting commit' '
122
git checkout branch1 &&
123
git tag original-branch1 &&
124
git rebase -i branch2 &&
125
test file6 = $(git diff --name-only original-branch1) &&
126
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
127
+ test $(git rev-parse I) = $(git rev-parse branch2) &&
128
test $(git rev-parse I) = $(git rev-parse HEAD~2)
129
'
130
@@ -144,9 +157,12 @@ EOF
157
158
test_expect_success 'stop on conflicting pick' '
159
git tag new-branch1 &&
147
- ! git rebase -i master &&
160
+ test_must_fail git rebase -i master &&
161
+ test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" &&
162
test_cmp expect .git/.dotest-merge/patch &&
163
test_cmp expect2 file1 &&
164
+ test "$(git-diff --name-status |
165
+ sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
166
test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
167
test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
168
'
@@ -154,6 +170,7 @@ test_expect_success 'stop on conflicting pick' '
170
test_expect_success 'abort' '
171
git rebase --abort &&
172
test $(git rev-parse new-branch1) = $(git rev-parse HEAD) &&
173
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
174
! test -d .git/.dotest-merge
175
'
176
@@ -213,7 +230,7 @@ test_expect_success 'preserve merges with -p' '
230
231
test_expect_success '--continue tries to commit' '
232
test_tick &&
216
- ! git rebase -i --onto new-branch1 HEAD^ &&
233
+ test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
234
echo resolved > file1 &&
235
git add file1 &&
236
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue &&
@@ -224,7 +241,7 @@ test_expect_success '--continue tries to commit' '
241
test_expect_success 'verbose flag is heeded, even after --continue' '
242
git reset --hard HEAD@{1} &&
243
test_tick &&
227
- ! git rebase -v -i --onto new-branch1 HEAD^ &&
244
+ test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
245
echo resolved > file1 &&
246
git add file1 &&
247
git rebase --continue > output &&
@@ -259,10 +276,14 @@ test_expect_success 'interrupted squash works as expected' '
276
git commit -m $n
277
done &&
278
one=$(git rev-parse HEAD~3) &&
262
- ! FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
279
+ (
280
+ FAKE_LINES="1 squash 3 2" &&
281
+ export FAKE_LINES &&
282
+ test_must_fail git rebase -i HEAD~3
283
+ ) &&
284
(echo one; echo two; echo four) > conflict &&
285
git add conflict &&
265
- ! git rebase --continue &&
286
+ test_must_fail git rebase --continue &&
287
echo resolved > conflict &&
288
git add conflict &&
289
git rebase --continue &&
@@ -277,13 +298,17 @@ test_expect_success 'interrupted squash works as expected (case 2)' '
298
git commit -m $n
299
done &&
300
one=$(git rev-parse HEAD~3) &&
280
- ! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
301
+ (
302
+ FAKE_LINES="3 squash 1 2" &&
303
+ export FAKE_LINES &&
304
+ test_must_fail git rebase -i HEAD~3
305
+ ) &&
306
(echo one; echo four) > conflict &&
307
git add conflict &&
283
- ! git rebase --continue &&
308
+ test_must_fail git rebase --continue &&
309
(echo one; echo two; echo four) > conflict &&
310
git add conflict &&
286
- ! git rebase --continue &&
311
+ test_must_fail git rebase --continue &&
312
echo resolved > conflict &&
313
git add conflict &&
314
git rebase --continue &&
@@ -331,7 +356,7 @@ test_expect_success 'rebase a commit violating pre-commit' '
356
chmod a+x $PRE_COMMIT &&
357
echo "monde! " >> file1 &&
358
test_tick &&
334
- ! git commit -m doesnt-verify file1 &&
359
+ test_must_fail git commit -m doesnt-verify file1 &&
360
git commit -m doesnt-verify --no-verify file1 &&
361
test_tick &&
362
FAKE_LINES=2 git rebase -i HEAD~2