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>
Phillip Wood committed
Sep 13, 2021 at 15:19 UTC
1e14bc11ed01e876809e62d2b13db71d6c0d265c
1 file changed
+10
-3
t/t3407-rebase-abort.sh
+10
-3
@@ -19,6 +19,13 @@ test_expect_success setup '
19
test_commit "merge should fail on this, too" a e pre-rebase
20
'
21
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
+
29
testrebase() {
30
type=$1
31
state_dir=$2
@@ -29,7 +36,7 @@ testrebase() {
36
test_must_fail git rebase$type main &&
37
test_path_is_dir "$state_dir" &&
38
git rebase --abort &&
32
- test_cmp_rev to-rebase pre-rebase &&
39
+ check_head &&
40
test_path_is_missing "$state_dir"
41
'
42
@@ -41,7 +48,7 @@ testrebase() {
48
test_must_fail git rebase --skip &&
49
test_cmp_rev HEAD main &&
50
git rebase --abort &&
44
- test_cmp_rev to-rebase pre-rebase &&
51
+ check_head &&
52
test_path_is_missing "$state_dir"
53
'
54
@@ -56,7 +63,7 @@ testrebase() {
63
test_must_fail git rebase --continue &&
64
test_cmp_rev ! HEAD main &&
65
git rebase --abort &&
59
- test_cmp_rev to-rebase pre-rebase &&
66
+ check_head &&
67
test_path_is_missing "$state_dir"
68
'
69