Skip to content

Commit 4947cf9

Browse files
glandiumgitster
authored andcommitted
t3407-rebase-abort.sh: Enhance existing tests, and add test for rebase --merge
Removing .dotest should actually not be needed, so just test the directory don't exist after --abort, but exists after starting the rebase. Also, execute the same tests with rebase --merge, which uses a different code path. Signed-off-by: Mike Hommey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 30b5940 commit 4947cf9

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

t/t3407-rebase-abort.sh

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,49 @@ test_expect_success setup '
2323
git branch pre-rebase
2424
'
2525

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)
30-
'
26+
testrebase() {
27+
type=$1
28+
dotest=$2
3129

32-
test_expect_success 'rebase --abort after --skip' '
33-
# Clean up the state from the previous one
34-
git reset --hard pre-rebase
35-
rm -rf .dotest
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'
38+
'
3639

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)
42-
'
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'
50+
'
4351

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
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'
65+
'
66+
}
4867

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)
57-
'
68+
testrebase "" .dotest
69+
testrebase " --merge" .git/.dotest-merge
5870

5971
test_done

0 commit comments

Comments
 (0)