t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C
These new tests make sure I don't miss any check being performed before rebase is proceeded (which is well tested by other tests) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
May 24, 2009 at 01:31 UTC
7a7eb5173d4e16f0323b2c4078e88fc0a40c38b6
1 file changed
+31
t/t3400-rebase.sh
+31
@@ -41,9 +41,40 @@ test_expect_success \
41
git tag topic
42
'
43
44
+test_expect_success 'rebase on dirty worktree' '
45
+ echo dirty >> A &&
46
+ test_must_fail git rebase master'
47
+
48
+test_expect_success 'rebase on dirty cache' '
49
+ git add A &&
50
+ test_must_fail git rebase master'
51
+
52
test_expect_success 'rebase against master' '
53
+ git reset --hard HEAD &&
54
git rebase master'
55
56
+test_expect_success 'rebase against master twice' '
57
+ git rebase master 2>err &&
58
+ grep "Current branch my-topic-branch is up to date" err
59
+'
60
+
61
+test_expect_success 'rebase against master twice with --force' '
62
+ git rebase --force-rebase master >out &&
63
+ grep "Current branch my-topic-branch is up to date, rebase forced" out
64
+'
65
+
66
+test_expect_success 'rebase against master twice from another branch' '
67
+ git checkout my-topic-branch^ &&
68
+ git rebase master my-topic-branch 2>err &&
69
+ grep "Current branch my-topic-branch is up to date" err
70
+'
71
+
72
+test_expect_success 'rebase fast-forward to master' '
73
+ git checkout my-topic-branch^ &&
74
+ git rebase my-topic-branch 2>err &&
75
+ grep "Fast-forwarded HEAD to my-topic-branch" err
76
+'
77
+
78
test_expect_success \
79
'the rebase operation should not have destroyed author information' \
80
'! (git log | grep "Author:" | grep "<>")'