Blame


1 2822a352 2019-10-15 stsp #!/bin/sh
2 2822a352 2019-10-15 stsp #
3 2822a352 2019-10-15 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 2822a352 2019-10-15 stsp #
5 2822a352 2019-10-15 stsp # Permission to use, copy, modify, and distribute this software for any
6 2822a352 2019-10-15 stsp # purpose with or without fee is hereby granted, provided that the above
7 2822a352 2019-10-15 stsp # copyright notice and this permission notice appear in all copies.
8 2822a352 2019-10-15 stsp #
9 2822a352 2019-10-15 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 2822a352 2019-10-15 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 2822a352 2019-10-15 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 2822a352 2019-10-15 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 2822a352 2019-10-15 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 2822a352 2019-10-15 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 2822a352 2019-10-15 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 2822a352 2019-10-15 stsp
17 2822a352 2019-10-15 stsp . ./common.sh
18 2822a352 2019-10-15 stsp
19 2822a352 2019-10-15 stsp function test_integrate_basic {
20 2822a352 2019-10-15 stsp local testroot=`test_init integrate_basic`
21 2822a352 2019-10-15 stsp
22 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
23 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
24 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
25 2822a352 2019-10-15 stsp
26 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
27 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
28 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
29 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
30 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
31 2822a352 2019-10-15 stsp
32 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
33 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
34 2822a352 2019-10-15 stsp
35 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
36 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
37 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
38 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
39 2822a352 2019-10-15 stsp
40 2822a352 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
41 2822a352 2019-10-15 stsp ret="$?"
42 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
43 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
44 2822a352 2019-10-15 stsp return 1
45 2822a352 2019-10-15 stsp fi
46 2822a352 2019-10-15 stsp
47 2822a352 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
48 2822a352 2019-10-15 stsp ret="$?"
49 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
50 2822a352 2019-10-15 stsp echo "got rebase failed unexpectedly"
51 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
52 2822a352 2019-10-15 stsp return 1
53 2822a352 2019-10-15 stsp fi
54 2822a352 2019-10-15 stsp
55 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
56 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
57 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
58 2822a352 2019-10-15 stsp
59 2822a352 2019-10-15 stsp (cd $testroot/wt && got update -b master > /dev/null)
60 2822a352 2019-10-15 stsp ret="$?"
61 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
62 2822a352 2019-10-15 stsp echo "got update failed unexpectedly"
63 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
64 2822a352 2019-10-15 stsp return 1
65 2822a352 2019-10-15 stsp fi
66 2822a352 2019-10-15 stsp
67 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch > $testroot/stdout)
68 2822a352 2019-10-15 stsp
69 2822a352 2019-10-15 stsp echo "U alpha" > $testroot/stdout.expected
70 2822a352 2019-10-15 stsp echo "D beta" >> $testroot/stdout.expected
71 2822a352 2019-10-15 stsp echo "A epsilon/new" >> $testroot/stdout.expected
72 2822a352 2019-10-15 stsp echo "U gamma/delta" >> $testroot/stdout.expected
73 2822a352 2019-10-15 stsp echo "Integrated refs/heads/newbranch into refs/heads/master" \
74 2822a352 2019-10-15 stsp >> $testroot/stdout.expected
75 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
76 2822a352 2019-10-15 stsp ret="$?"
77 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
78 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
79 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
80 2822a352 2019-10-15 stsp return 1
81 2822a352 2019-10-15 stsp fi
82 2822a352 2019-10-15 stsp
83 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/content.expected
84 2822a352 2019-10-15 stsp cat $testroot/wt/gamma/delta > $testroot/content
85 2822a352 2019-10-15 stsp cmp -s $testroot/content.expected $testroot/content
86 2822a352 2019-10-15 stsp ret="$?"
87 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
88 2822a352 2019-10-15 stsp diff -u $testroot/content.expected $testroot/content
89 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
90 2822a352 2019-10-15 stsp return 1
91 2822a352 2019-10-15 stsp fi
92 2822a352 2019-10-15 stsp
93 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/content.expected
94 2822a352 2019-10-15 stsp cat $testroot/wt/alpha > $testroot/content
95 2822a352 2019-10-15 stsp cmp -s $testroot/content.expected $testroot/content
96 2822a352 2019-10-15 stsp ret="$?"
97 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
98 2822a352 2019-10-15 stsp diff -u $testroot/content.expected $testroot/content
99 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
100 2822a352 2019-10-15 stsp return 1
101 2822a352 2019-10-15 stsp fi
102 2822a352 2019-10-15 stsp
103 2822a352 2019-10-15 stsp if [ -e $testroot/wt/beta ]; then
104 2822a352 2019-10-15 stsp echo "removed file beta still exists on disk" >&2
105 2822a352 2019-10-15 stsp test_done "$testroot" "1"
106 2822a352 2019-10-15 stsp return 1
107 2822a352 2019-10-15 stsp fi
108 2822a352 2019-10-15 stsp
109 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/content.expected
110 2822a352 2019-10-15 stsp cat $testroot/wt/epsilon/new > $testroot/content
111 2822a352 2019-10-15 stsp cmp -s $testroot/content.expected $testroot/content
112 2822a352 2019-10-15 stsp ret="$?"
113 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
114 2822a352 2019-10-15 stsp diff -u $testroot/content.expected $testroot/content
115 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
116 2822a352 2019-10-15 stsp return 1
117 2822a352 2019-10-15 stsp fi
118 2822a352 2019-10-15 stsp
119 2822a352 2019-10-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
120 2822a352 2019-10-15 stsp
121 2822a352 2019-10-15 stsp echo -n > $testroot/stdout.expected
122 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
123 2822a352 2019-10-15 stsp ret="$?"
124 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
125 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
126 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
127 2822a352 2019-10-15 stsp return 1
128 2822a352 2019-10-15 stsp fi
129 2822a352 2019-10-15 stsp
130 2822a352 2019-10-15 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
131 2822a352 2019-10-15 stsp echo "commit $new_commit2 (master, newbranch)" \
132 2822a352 2019-10-15 stsp > $testroot/stdout.expected
133 2822a352 2019-10-15 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
134 2822a352 2019-10-15 stsp echo "commit $master_commit" >> $testroot/stdout.expected
135 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
136 2822a352 2019-10-15 stsp ret="$?"
137 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
138 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
139 2822a352 2019-10-15 stsp fi
140 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
141 2822a352 2019-10-15 stsp }
142 2822a352 2019-10-15 stsp
143 2822a352 2019-10-15 stsp function test_integrate_requires_rebase_first {
144 2822a352 2019-10-15 stsp local testroot=`test_init integrate_requires_rebase_first`
145 2822a352 2019-10-15 stsp local init_commit=`git_show_head $testroot/repo`
146 2822a352 2019-10-15 stsp
147 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
148 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
149 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
150 2822a352 2019-10-15 stsp
151 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
152 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
153 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
154 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
155 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
156 2822a352 2019-10-15 stsp
157 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
158 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
159 2822a352 2019-10-15 stsp
160 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
161 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
162 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
163 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
164 2822a352 2019-10-15 stsp
165 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
166 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
167 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
168 2822a352 2019-10-15 stsp
169 2822a352 2019-10-15 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
170 2822a352 2019-10-15 stsp ret="$?"
171 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
172 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
173 2822a352 2019-10-15 stsp return 1
174 2822a352 2019-10-15 stsp fi
175 2822a352 2019-10-15 stsp
176 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch \
177 2822a352 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
178 2822a352 2019-10-15 stsp ret="$?"
179 2822a352 2019-10-15 stsp if [ "$ret" == "0" ]; then
180 2822a352 2019-10-15 stsp echo "got integrate succeeded unexpectedly"
181 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
182 2822a352 2019-10-15 stsp return 1
183 2822a352 2019-10-15 stsp fi
184 2822a352 2019-10-15 stsp
185 2822a352 2019-10-15 stsp echo -n > $testroot/stdout.expected
186 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
187 2822a352 2019-10-15 stsp ret="$?"
188 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
189 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
190 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
191 2822a352 2019-10-15 stsp return 1
192 2822a352 2019-10-15 stsp fi
193 2822a352 2019-10-15 stsp
194 2822a352 2019-10-15 stsp echo "got: specified branch must be rebased first" \
195 2822a352 2019-10-15 stsp > $testroot/stderr.expected
196 2822a352 2019-10-15 stsp cmp -s $testroot/stderr.expected $testroot/stderr
197 2822a352 2019-10-15 stsp ret="$?"
198 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
199 2822a352 2019-10-15 stsp diff -u $testroot/stderr.expected $testroot/stderr
200 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
201 2822a352 2019-10-15 stsp return 1
202 2822a352 2019-10-15 stsp fi
203 2822a352 2019-10-15 stsp
204 2822a352 2019-10-15 stsp (cd $testroot/repo && got log -c master | \
205 2822a352 2019-10-15 stsp grep ^commit > $testroot/stdout)
206 2822a352 2019-10-15 stsp echo "commit $master_commit (master)" > $testroot/stdout.expected
207 2822a352 2019-10-15 stsp echo "commit $init_commit" >> $testroot/stdout.expected
208 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
209 2822a352 2019-10-15 stsp ret="$?"
210 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
211 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
212 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
213 2822a352 2019-10-15 stsp return 1
214 2822a352 2019-10-15 stsp fi
215 2822a352 2019-10-15 stsp
216 2822a352 2019-10-15 stsp (cd $testroot/repo && got log -c newbranch | \
217 2822a352 2019-10-15 stsp grep ^commit > $testroot/stdout)
218 2822a352 2019-10-15 stsp echo "commit $new_commit2 (newbranch)" \
219 2822a352 2019-10-15 stsp > $testroot/stdout.expected
220 2822a352 2019-10-15 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
221 2822a352 2019-10-15 stsp echo "commit $init_commit" >> $testroot/stdout.expected
222 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
223 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
224 2822a352 2019-10-15 stsp ret="$?"
225 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
226 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
227 2822a352 2019-10-15 stsp fi
228 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
229 2822a352 2019-10-15 stsp }
230 2822a352 2019-10-15 stsp
231 2822a352 2019-10-15 stsp function test_integrate_path_prefix {
232 2822a352 2019-10-15 stsp local testroot=`test_init integrate_path_prefix`
233 2822a352 2019-10-15 stsp
234 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
235 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
236 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
237 2822a352 2019-10-15 stsp
238 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
239 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
240 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
241 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
242 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
243 2822a352 2019-10-15 stsp
244 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
245 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
246 2822a352 2019-10-15 stsp
247 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
248 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
249 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
250 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
251 2822a352 2019-10-15 stsp
252 2822a352 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
253 2822a352 2019-10-15 stsp ret="$?"
254 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
255 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
256 2822a352 2019-10-15 stsp return 1
257 2822a352 2019-10-15 stsp fi
258 2822a352 2019-10-15 stsp
259 2822a352 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
260 2822a352 2019-10-15 stsp ret="$?"
261 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
262 2822a352 2019-10-15 stsp echo "got rebase failed unexpectedly"
263 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
264 2822a352 2019-10-15 stsp return 1
265 2822a352 2019-10-15 stsp fi
266 2822a352 2019-10-15 stsp
267 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
268 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
269 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
270 2822a352 2019-10-15 stsp
271 2822a352 2019-10-15 stsp rm -r $testroot/wt
272 2822a352 2019-10-15 stsp got checkout -b master -p epsilon $testroot/repo $testroot/wt \
273 2822a352 2019-10-15 stsp > /dev/null
274 2822a352 2019-10-15 stsp ret="$?"
275 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
276 2822a352 2019-10-15 stsp echo "got checkout failed unexpectedly"
277 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
278 2822a352 2019-10-15 stsp return 1
279 2822a352 2019-10-15 stsp fi
280 2822a352 2019-10-15 stsp
281 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch > $testroot/stdout)
282 2822a352 2019-10-15 stsp
283 2822a352 2019-10-15 stsp echo "A new" > $testroot/stdout.expected
284 2822a352 2019-10-15 stsp echo "Integrated refs/heads/newbranch into refs/heads/master" \
285 2822a352 2019-10-15 stsp >> $testroot/stdout.expected
286 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
287 2822a352 2019-10-15 stsp ret="$?"
288 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
289 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
290 2822a352 2019-10-15 stsp fi
291 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
292 2822a352 2019-10-15 stsp }
293 3aef623b 2019-10-15 stsp
294 3aef623b 2019-10-15 stsp function test_integrate_backwards_in_time {
295 3aef623b 2019-10-15 stsp local testroot=`test_init integrate_backwards_in_time`
296 3aef623b 2019-10-15 stsp
297 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
298 3aef623b 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
299 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
300 3aef623b 2019-10-15 stsp
301 3aef623b 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
302 3aef623b 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
303 3aef623b 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
304 3aef623b 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
305 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
306 3aef623b 2019-10-15 stsp
307 3aef623b 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
308 3aef623b 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
309 3aef623b 2019-10-15 stsp
310 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
311 3aef623b 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
312 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
313 3aef623b 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
314 2822a352 2019-10-15 stsp
315 3aef623b 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
316 3aef623b 2019-10-15 stsp ret="$?"
317 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
318 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
319 3aef623b 2019-10-15 stsp return 1
320 3aef623b 2019-10-15 stsp fi
321 2822a352 2019-10-15 stsp
322 3aef623b 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
323 3aef623b 2019-10-15 stsp ret="$?"
324 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
325 3aef623b 2019-10-15 stsp echo "got rebase failed unexpectedly"
326 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
327 3aef623b 2019-10-15 stsp return 1
328 3aef623b 2019-10-15 stsp fi
329 3aef623b 2019-10-15 stsp
330 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
331 3aef623b 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
332 3aef623b 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
333 3aef623b 2019-10-15 stsp
334 3aef623b 2019-10-15 stsp # attempt to integrate master into newbranch (wrong way around)
335 3aef623b 2019-10-15 stsp (cd $testroot/wt && got update -b newbranch > /dev/null)
336 3aef623b 2019-10-15 stsp ret="$?"
337 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
338 3aef623b 2019-10-15 stsp echo "got update failed unexpectedly"
339 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
340 3aef623b 2019-10-15 stsp return 1
341 3aef623b 2019-10-15 stsp fi
342 3aef623b 2019-10-15 stsp
343 3aef623b 2019-10-15 stsp (cd $testroot/wt && got integrate master \
344 3aef623b 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
345 3aef623b 2019-10-15 stsp ret="$?"
346 3aef623b 2019-10-15 stsp if [ "$ret" == "0" ]; then
347 3aef623b 2019-10-15 stsp echo "got integrate succeeded unexpectedly"
348 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
349 3aef623b 2019-10-15 stsp return 1
350 3aef623b 2019-10-15 stsp fi
351 3aef623b 2019-10-15 stsp
352 3aef623b 2019-10-15 stsp echo -n > $testroot/stdout.expected
353 3aef623b 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
354 3aef623b 2019-10-15 stsp ret="$?"
355 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
356 3aef623b 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
357 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
358 3aef623b 2019-10-15 stsp return 1
359 3aef623b 2019-10-15 stsp fi
360 3aef623b 2019-10-15 stsp
361 3aef623b 2019-10-15 stsp echo "got: specified branch must be rebased first" \
362 3aef623b 2019-10-15 stsp > $testroot/stderr.expected
363 3aef623b 2019-10-15 stsp cmp -s $testroot/stderr.expected $testroot/stderr
364 3aef623b 2019-10-15 stsp ret="$?"
365 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
366 3aef623b 2019-10-15 stsp diff -u $testroot/stderr.expected $testroot/stderr
367 3aef623b 2019-10-15 stsp fi
368 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
369 3aef623b 2019-10-15 stsp }
370 3aef623b 2019-10-15 stsp
371 2822a352 2019-10-15 stsp run_test test_integrate_basic
372 2822a352 2019-10-15 stsp run_test test_integrate_requires_rebase_first
373 2822a352 2019-10-15 stsp run_test test_integrate_path_prefix
374 3aef623b 2019-10-15 stsp run_test test_integrate_backwards_in_time