Skip to content

Commit aececab

Browse files
Denton-Lgitster
authored andcommitted
t3431: add rebase --fork-point tests
Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dd605e4 commit aececab

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

t/t3431-rebase-fork-point.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2019 Denton Liu
4+
#
5+
6+
test_description='git rebase --fork-point test'
7+
8+
. ./test-lib.sh
9+
10+
# A---B---D---E (master)
11+
# \
12+
# C*---F---G (side)
13+
#
14+
# C was formerly part of master but master was rewound to remove C
15+
#
16+
test_expect_success setup '
17+
test_commit A &&
18+
test_commit B &&
19+
test_commit C &&
20+
git branch -t side &&
21+
git reset --hard HEAD^ &&
22+
test_commit D &&
23+
test_commit E &&
24+
git checkout side &&
25+
test_commit F &&
26+
test_commit G
27+
'
28+
29+
test_rebase () {
30+
expected="$1" &&
31+
shift &&
32+
test_expect_success "git rebase $*" "
33+
git checkout master &&
34+
git reset --hard E &&
35+
git checkout side &&
36+
git reset --hard G &&
37+
git rebase $* &&
38+
test_write_lines $expected >expect &&
39+
git log --pretty=%s >actual &&
40+
test_cmp expect actual
41+
"
42+
}
43+
44+
test_rebase 'G F E D B A'
45+
test_rebase 'G F D B A' --onto D
46+
test_rebase 'G F C E D B A' --no-fork-point
47+
test_rebase 'G F C D B A' --no-fork-point --onto D
48+
test_rebase 'G F E D B A' --fork-point refs/heads/master
49+
test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
50+
test_rebase 'G F C E D B A' refs/heads/master
51+
test_rebase 'G F C D B A' --onto D refs/heads/master
52+
53+
test_done

0 commit comments

Comments
 (0)