Skip to content

Commit 1e14bc1

Browse files
phillipwoodgitster
authored andcommitted
t3407: strengthen rebase --abort tests
The existing tests only check that HEAD points to the correct commit after aborting, they do not check that the original branch is checked out. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0b7ae73 commit 1e14bc1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

t/t3407-rebase-abort.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ test_expect_success setup '
1919
test_commit "merge should fail on this, too" a e pre-rebase
2020
'
2121

22+
# Check that HEAD is equal to "pre-rebase" and the current branch is
23+
# "to-rebase"
24+
check_head() {
25+
test_cmp_rev HEAD pre-rebase &&
26+
test "$(git symbolic-ref HEAD)" = refs/heads/to-rebase
27+
}
28+
2229
testrebase() {
2330
type=$1
2431
state_dir=$2
@@ -29,7 +36,7 @@ testrebase() {
2936
test_must_fail git rebase$type main &&
3037
test_path_is_dir "$state_dir" &&
3138
git rebase --abort &&
32-
test_cmp_rev to-rebase pre-rebase &&
39+
check_head &&
3340
test_path_is_missing "$state_dir"
3441
'
3542

@@ -41,7 +48,7 @@ testrebase() {
4148
test_must_fail git rebase --skip &&
4249
test_cmp_rev HEAD main &&
4350
git rebase --abort &&
44-
test_cmp_rev to-rebase pre-rebase &&
51+
check_head &&
4552
test_path_is_missing "$state_dir"
4653
'
4754

@@ -56,7 +63,7 @@ testrebase() {
5663
test_must_fail git rebase --continue &&
5764
test_cmp_rev ! HEAD main &&
5865
git rebase --abort &&
59-
test_cmp_rev to-rebase pre-rebase &&
66+
check_head &&
6067
test_path_is_missing "$state_dir"
6168
'
6269

0 commit comments

Comments
 (0)