rebase tests: test linear branch topology

Add tests rebasing a linear branch topology to linear rebase tests added in 2aad7cace2 ("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 <avarab@gmail.com> Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Aug 27, 2019 at 01:38 UTC 6330209d7d34f72e2e1511f7e42e267b926ff64d
1 file changed +29
t/t3421-rebase-topology-linear.sh
+29
@@ -31,6 +31,16 @@ test_run_rebase success -m
31 test_run_rebase success -i
32 test_have_prereq !REBASE_P || test_run_rebase success -p
33
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 +
44 test_run_rebase () {
45 result=$1
46 shift
@@ -57,10 +67,28 @@ test_run_rebase () {
67 "
68 }
69 test_run_rebase success ''
70 +test_run_rebase success --fork-point
71 test_run_rebase success -m
72 test_run_rebase success -i
73 test_have_prereq !REBASE_P || test_run_rebase failure -p
74
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 +
92 test_run_rebase () {
93 result=$1
94 shift
@@ -71,6 +99,7 @@ test_run_rebase () {
99 "
100 }
101 test_run_rebase success ''
102 +test_run_rebase success --fork-point
103 test_run_rebase success -m
104 test_run_rebase success -i
105 test_have_prereq !REBASE_P || test_run_rebase success -p