The third batch
[git.git] / t / t3425-rebase-topology-merges.sh
bloba16428bdf54ab9157dfefb7cc9797e4c5dd86e1e
1 #!/bin/sh
3 test_description='rebase topology tests with merges'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-rebase.sh
9 test_revision_subjects () {
10 expected="$1"
11 shift
12 set -- $(git log --format=%s --no-walk=unsorted "$@")
13 test "$expected" = "$*"
16 # a---b-----------c
17 # \ \
18 # d-------e \
19 # \ \ \
20 # n---o---w---v
21 # \
22 # z
23 test_expect_success 'setup of non-linear-history' '
24 test_commit a &&
25 test_commit b &&
26 test_commit c &&
27 git checkout b &&
28 test_commit d &&
29 test_commit e &&
31 git checkout c &&
32 test_commit g &&
33 revert h g &&
34 git checkout d &&
35 cherry_pick gp g &&
36 test_commit i &&
37 git checkout b &&
38 test_commit f &&
40 git checkout d &&
41 test_commit n &&
42 test_commit o &&
43 test_merge w e &&
44 test_merge v c &&
45 git checkout o &&
46 test_commit z
49 test_run_rebase () {
50 result=$1
51 shift
52 test_expect_$result "rebase $* after merge from upstream" "
53 reset_rebase &&
54 git rebase $* e w &&
55 test_cmp_rev e HEAD~2 &&
56 test_linear_range 'n o' e..
59 test_run_rebase success --apply
60 test_run_rebase success -m
61 test_run_rebase success -i
63 test_run_rebase () {
64 result=$1
65 shift
66 expected=$1
67 shift
68 test_expect_$result "rebase $* of non-linear history is linearized in place" "
69 reset_rebase &&
70 git rebase $* d w &&
71 test_cmp_rev d HEAD~3 &&
72 test_linear_range "\'"$expected"\'" d..
75 test_run_rebase success 'n o e' --apply
76 test_run_rebase success 'n o e' -m
77 test_run_rebase success 'n o e' -i
79 test_run_rebase () {
80 result=$1
81 shift
82 expected=$1
83 shift
84 test_expect_$result "rebase $* of non-linear history is linearized upstream" "
85 reset_rebase &&
86 git rebase $* c w &&
87 test_cmp_rev c HEAD~4 &&
88 test_linear_range "\'"$expected"\'" c..
91 test_run_rebase success 'd n o e' --apply
92 test_run_rebase success 'd n o e' -m
93 test_run_rebase success 'd n o e' -i
95 test_run_rebase () {
96 result=$1
97 shift
98 expected=$1
99 shift
100 test_expect_$result "rebase $* of non-linear history with merges after upstream merge is linearized" "
101 reset_rebase &&
102 git rebase $* c v &&
103 test_cmp_rev c HEAD~4 &&
104 test_linear_range "\'"$expected"\'" c..
107 test_run_rebase success 'd n o e' --apply
108 test_run_rebase success 'd n o e' -m
109 test_run_rebase success 'd n o e' -i
111 test_done