rebase: use correct base for --keep-base when a branch is given
[alt-git.git] / t / t3425-rebase-topology-merges.sh
blob63acc1ea4dab43e5fc1f9eb26b031f49e3d9a432
1 #!/bin/sh
3 test_description='rebase topology tests with merges'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-rebase.sh
7 test_revision_subjects () {
8 expected="$1"
9 shift
10 set -- $(git log --format=%s --no-walk=unsorted "$@")
11 test "$expected" = "$*"
14 # a---b-----------c
15 # \ \
16 # d-------e \
17 # \ \ \
18 # n---o---w---v
19 # \
20 # z
21 test_expect_success 'setup of non-linear-history' '
22 test_commit a &&
23 test_commit b &&
24 test_commit c &&
25 git checkout b &&
26 test_commit d &&
27 test_commit e &&
29 git checkout c &&
30 test_commit g &&
31 revert h g &&
32 git checkout d &&
33 cherry_pick gp g &&
34 test_commit i &&
35 git checkout b &&
36 test_commit f &&
38 git checkout d &&
39 test_commit n &&
40 test_commit o &&
41 test_merge w e &&
42 test_merge v c &&
43 git checkout o &&
44 test_commit z
47 test_run_rebase () {
48 result=$1
49 shift
50 test_expect_$result "rebase $* after merge from upstream" "
51 reset_rebase &&
52 git rebase $* e w &&
53 test_cmp_rev e HEAD~2 &&
54 test_linear_range 'n o' e..
57 test_run_rebase success --apply
58 test_run_rebase success -m
59 test_run_rebase success -i
61 test_run_rebase () {
62 result=$1
63 shift
64 expected=$1
65 shift
66 test_expect_$result "rebase $* of non-linear history is linearized in place" "
67 reset_rebase &&
68 git rebase $* d w &&
69 test_cmp_rev d HEAD~3 &&
70 test_linear_range "\'"$expected"\'" d..
73 test_run_rebase success 'n o e' --apply
74 test_run_rebase success 'n o e' -m
75 test_run_rebase success 'n o e' -i
77 test_run_rebase () {
78 result=$1
79 shift
80 expected=$1
81 shift
82 test_expect_$result "rebase $* of non-linear history is linearized upstream" "
83 reset_rebase &&
84 git rebase $* c w &&
85 test_cmp_rev c HEAD~4 &&
86 test_linear_range "\'"$expected"\'" c..
89 test_run_rebase success 'd n o e' --apply
90 test_run_rebase success 'd n o e' -m
91 test_run_rebase success 'd n o e' -i
93 test_run_rebase () {
94 result=$1
95 shift
96 expected=$1
97 shift
98 test_expect_$result "rebase $* of non-linear history with merges after upstream merge is linearized" "
99 reset_rebase &&
100 git rebase $* c v &&
101 test_cmp_rev c HEAD~4 &&
102 test_linear_range "\'"$expected"\'" c..
105 test_run_rebase success 'd n o e' --apply
106 test_run_rebase success 'd n o e' -m
107 test_run_rebase success 'd n o e' -i
109 test_done