Skip to content

Commit 6330209

Browse files
avargitster
authored andcommitted
rebase tests: test linear branch topology
Add tests rebasing a linear branch topology to linear rebase tests added in 2aad7ca ("add simple tests of consistency across rebase types", 2013-06-06). These tests are duplicates of two surrounding tests that do the same with tags pointing to the same objects. Right now there's no change in behavior being introduced, but as we'll see in a subsequent change rebase can have different behaviors when working implicitly with remote tracking branches. While I'm at it add a --fork-point test, strictly speaking this is redundant to the existing '' test, as no argument to rebase implies --fork-point. But now it's easier to grep for tests that explicitly stress --fork-point. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4effc5b commit 6330209

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

t/t3421-rebase-topology-linear.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ test_run_rebase success -m
3131
test_run_rebase success -i
3232
test_have_prereq !REBASE_P || test_run_rebase success -p
3333

34+
test_expect_success 'setup branches and remote tracking' '
35+
git tag -l >tags &&
36+
for tag in $(cat tags)
37+
do
38+
git branch branch-$tag $tag || return 1
39+
done &&
40+
git remote add origin "file://$PWD" &&
41+
git fetch origin
42+
'
43+
3444
test_run_rebase () {
3545
result=$1
3646
shift
@@ -57,10 +67,28 @@ test_run_rebase () {
5767
"
5868
}
5969
test_run_rebase success ''
70+
test_run_rebase success --fork-point
6071
test_run_rebase success -m
6172
test_run_rebase success -i
6273
test_have_prereq !REBASE_P || test_run_rebase failure -p
6374

75+
test_run_rebase () {
76+
result=$1
77+
shift
78+
test_expect_$result "rebase $* -f rewrites even if remote upstream is an ancestor" "
79+
reset_rebase &&
80+
git rebase $* -f branch-b branch-e &&
81+
! test_cmp_rev branch-e origin/branch-e &&
82+
test_cmp_rev branch-b HEAD~2 &&
83+
test_linear_range 'd e' branch-b..
84+
"
85+
}
86+
test_run_rebase success ''
87+
test_run_rebase success --fork-point
88+
test_run_rebase success -m
89+
test_run_rebase success -i
90+
test_have_prereq !REBASE_P || test_run_rebase success -p
91+
6492
test_run_rebase () {
6593
result=$1
6694
shift
@@ -71,6 +99,7 @@ test_run_rebase () {
7199
"
72100
}
73101
test_run_rebase success ''
102+
test_run_rebase success --fork-point
74103
test_run_rebase success -m
75104
test_run_rebase success -i
76105
test_have_prereq !REBASE_P || test_run_rebase success -p

0 commit comments

Comments
 (0)