Skip to content

Commit 7a7eb51

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ffd311 commit 7a7eb51

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t3400-rebase.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,40 @@ test_expect_success \
4141
git tag topic
4242
'
4343

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+
4452
test_expect_success 'rebase against master' '
53+
git reset --hard HEAD &&
4554
git rebase master'
4655

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+
4778
test_expect_success \
4879
'the rebase operation should not have destroyed author information' \
4980
'! (git log | grep "Author:" | grep "<>")'

0 commit comments

Comments
 (0)