]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | test_description='rebase topology tests with merges' | |
4 | ||
5 | TEST_PASSES_SANITIZE_LEAK=true | |
6 | . ./test-lib.sh | |
7 | . "$TEST_DIRECTORY"/lib-rebase.sh | |
8 | ||
9 | test_revision_subjects () { | |
10 | expected="$1" | |
11 | shift | |
12 | set -- $(git log --format=%s --no-walk=unsorted "$@") | |
13 | test "$expected" = "$*" | |
14 | } | |
15 | ||
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 && | |
30 | ||
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 && | |
39 | ||
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 | |
47 | ' | |
48 | ||
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.. | |
57 | " | |
58 | } | |
59 | test_run_rebase success --apply | |
60 | test_run_rebase success -m | |
61 | test_run_rebase success -i | |
62 | ||
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.. | |
73 | " | |
74 | } | |
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 | |
78 | ||
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.. | |
89 | " | |
90 | } | |
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 | |
94 | ||
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.. | |
105 | " | |
106 | } | |
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 | |
110 | ||
111 | test_done |