use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t3416-rebase-onto-threedots.sh
blob9c2548423bcef02e060d0c7047e920f3e6f2485a
1 #!/bin/sh
3 test_description='git rebase --onto A...B'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-rebase.sh"
8 # Rebase only the tip commit of "topic" on merge base between "master"
9 # and "topic". Cannot do this for "side" with "master" because there
10 # is no single merge base.
13 # F---G topic G'
14 # / /
15 # A---B---C---D---E master --> A---B---C---D---E
16 # \ \ /
17 # \ x
18 # \ / \
19 # H---I---J---K side
21 test_expect_success setup '
22 test_commit A &&
23 test_commit B &&
24 git branch side &&
25 test_commit C &&
26 git branch topic &&
27 git checkout side &&
28 test_commit H &&
29 git checkout master &&
30 test_tick &&
31 git merge H &&
32 git tag D &&
33 test_commit E &&
34 git checkout topic &&
35 test_commit F &&
36 test_commit G &&
37 git checkout side &&
38 test_tick &&
39 git merge C &&
40 git tag I &&
41 test_commit J &&
42 test_commit K
45 test_expect_success 'rebase --onto master...topic' '
46 git reset --hard &&
47 git checkout topic &&
48 git reset --hard G &&
50 git rebase --onto master...topic F &&
51 git rev-parse HEAD^1 >actual &&
52 git rev-parse C^0 >expect &&
53 test_cmp expect actual
56 test_expect_success 'rebase --onto master...' '
57 git reset --hard &&
58 git checkout topic &&
59 git reset --hard G &&
61 git rebase --onto master... F &&
62 git rev-parse HEAD^1 >actual &&
63 git rev-parse C^0 >expect &&
64 test_cmp expect actual
67 test_expect_success 'rebase --onto master...side' '
68 git reset --hard &&
69 git checkout side &&
70 git reset --hard K &&
72 test_must_fail git rebase --onto master...side J
75 test_expect_success 'rebase -i --onto master...topic' '
76 git reset --hard &&
77 git checkout topic &&
78 git reset --hard G &&
79 set_fake_editor &&
80 EXPECT_COUNT=1 git rebase -i --onto master...topic F &&
81 git rev-parse HEAD^1 >actual &&
82 git rev-parse C^0 >expect &&
83 test_cmp expect actual
86 test_expect_success 'rebase -i --onto master...' '
87 git reset --hard &&
88 git checkout topic &&
89 git reset --hard G &&
90 set_fake_editor &&
91 EXPECT_COUNT=1 git rebase -i --onto master... F &&
92 git rev-parse HEAD^1 >actual &&
93 git rev-parse C^0 >expect &&
94 test_cmp expect actual
97 test_expect_success 'rebase -i --onto master...side' '
98 git reset --hard &&
99 git checkout side &&
100 git reset --hard K &&
102 set_fake_editor &&
103 test_must_fail git rebase -i --onto master...side J
106 test_expect_success 'rebase --keep-base --onto incompatible' '
107 test_must_fail git rebase --keep-base --onto master...
110 test_expect_success 'rebase --keep-base --root incompatible' '
111 test_must_fail git rebase --keep-base --root
114 test_expect_success 'rebase --keep-base master from topic' '
115 git reset --hard &&
116 git checkout topic &&
117 git reset --hard G &&
119 git rebase --keep-base master &&
120 git rev-parse C >base.expect &&
121 git merge-base master HEAD >base.actual &&
122 test_cmp base.expect base.actual &&
124 git rev-parse HEAD~2 >actual &&
125 git rev-parse C^0 >expect &&
126 test_cmp expect actual
129 test_expect_success 'rebase --keep-base master from side' '
130 git reset --hard &&
131 git checkout side &&
132 git reset --hard K &&
134 test_must_fail git rebase --keep-base master
137 test_expect_success 'rebase -i --keep-base master from topic' '
138 git reset --hard &&
139 git checkout topic &&
140 git reset --hard G &&
142 set_fake_editor &&
143 EXPECT_COUNT=2 git rebase -i --keep-base master &&
144 git rev-parse C >base.expect &&
145 git merge-base master HEAD >base.actual &&
146 test_cmp base.expect base.actual &&
148 git rev-parse HEAD~2 >actual &&
149 git rev-parse C^0 >expect &&
150 test_cmp expect actual
153 test_expect_success 'rebase -i --keep-base master from side' '
154 git reset --hard &&
155 git checkout side &&
156 git reset --hard K &&
158 set_fake_editor &&
159 test_must_fail git rebase -i --keep-base master
162 test_done