3 2822a352 2019-10-15 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
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.
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.
17 2822a352 2019-10-15 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_integrate_basic() {
20 2822a352 2019-10-15 stsp local testroot=`test_init integrate_basic`
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"
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"
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`
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`
40 2822a352 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
42 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
43 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
47 2822a352 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
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"
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`
59 2822a352 2019-10-15 stsp (cd $testroot/wt && got update -b master > /dev/null)
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"
67 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch > $testroot/stdout)
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
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"
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
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"
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
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"
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"
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
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"
119 2822a352 2019-10-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
121 2822a352 2019-10-15 stsp echo -n > $testroot/stdout.expected
122 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
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"
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
137 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
138 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
140 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
143 f6cae3ed 2020-09-13 naddy 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`
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"
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"
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`
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`
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`
169 2822a352 2019-10-15 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
171 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
172 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
176 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch \
177 2822a352 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
179 54c39596 2020-12-28 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"
185 2822a352 2019-10-15 stsp echo -n > $testroot/stdout.expected
186 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
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"
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
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"
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
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"
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
224 8b692cd0 2019-10-21 stsp if [ "$ret" != "0" ]; then
225 8b692cd0 2019-10-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
226 8b692cd0 2019-10-21 stsp test_done "$testroot" "$ret"
230 8b692cd0 2019-10-21 stsp (cd $testroot/repo && got branch -l > $testroot/stdout)
232 8b692cd0 2019-10-21 stsp if [ "$ret" != "0" ]; then
233 8b692cd0 2019-10-21 stsp echo "got rebase failed unexpectedly"
234 8b692cd0 2019-10-21 stsp test_done "$testroot" "$ret"
238 8b692cd0 2019-10-21 stsp echo " master: $master_commit" > $testroot/stdout.expected
239 8b692cd0 2019-10-21 stsp echo " newbranch: $new_commit2" >> $testroot/stdout.expected
240 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
242 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
243 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
245 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
248 f6cae3ed 2020-09-13 naddy test_integrate_path_prefix() {
249 2822a352 2019-10-15 stsp local testroot=`test_init integrate_path_prefix`
251 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
252 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
253 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
255 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
256 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
257 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
258 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
259 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
261 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
262 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
264 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
265 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
266 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
267 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
269 2822a352 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
271 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
272 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
276 2822a352 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
278 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
279 2822a352 2019-10-15 stsp echo "got rebase failed unexpectedly"
280 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
284 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
285 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
286 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
288 2822a352 2019-10-15 stsp rm -r $testroot/wt
289 2822a352 2019-10-15 stsp got checkout -b master -p epsilon $testroot/repo $testroot/wt \
290 2822a352 2019-10-15 stsp > /dev/null
292 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
293 2822a352 2019-10-15 stsp echo "got checkout failed unexpectedly"
294 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
298 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch > $testroot/stdout)
300 2822a352 2019-10-15 stsp echo "A new" > $testroot/stdout.expected
301 2822a352 2019-10-15 stsp echo "Integrated refs/heads/newbranch into refs/heads/master" \
302 2822a352 2019-10-15 stsp >> $testroot/stdout.expected
303 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
305 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
306 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
308 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
311 f6cae3ed 2020-09-13 naddy test_integrate_backwards_in_time() {
312 3aef623b 2019-10-15 stsp local testroot=`test_init integrate_backwards_in_time`
314 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
315 3aef623b 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
316 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
318 3aef623b 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
319 3aef623b 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
320 3aef623b 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
321 3aef623b 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
322 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
324 3aef623b 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
325 3aef623b 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
327 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
328 3aef623b 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
329 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
330 3aef623b 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
332 3aef623b 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
334 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
335 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
339 3aef623b 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
341 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
342 3aef623b 2019-10-15 stsp echo "got rebase failed unexpectedly"
343 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
347 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
348 3aef623b 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
349 3aef623b 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
351 3aef623b 2019-10-15 stsp # attempt to integrate master into newbranch (wrong way around)
352 3aef623b 2019-10-15 stsp (cd $testroot/wt && got update -b newbranch > /dev/null)
354 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
355 3aef623b 2019-10-15 stsp echo "got update failed unexpectedly"
356 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
360 3aef623b 2019-10-15 stsp (cd $testroot/wt && got integrate master \
361 3aef623b 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
363 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
364 3aef623b 2019-10-15 stsp echo "got integrate succeeded unexpectedly"
365 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
369 3aef623b 2019-10-15 stsp echo -n > $testroot/stdout.expected
370 3aef623b 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
372 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
373 3aef623b 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
374 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
378 3aef623b 2019-10-15 stsp echo "got: specified branch must be rebased first" \
379 3aef623b 2019-10-15 stsp > $testroot/stderr.expected
380 3aef623b 2019-10-15 stsp cmp -s $testroot/stderr.expected $testroot/stderr
382 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
383 3aef623b 2019-10-15 stsp diff -u $testroot/stderr.expected $testroot/stderr
385 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
388 f6d8c0ac 2020-11-09 stsp test_integrate_replace_symlink_with_file() {
389 f6d8c0ac 2020-11-09 stsp local testroot=`test_init integrate_replace_symlink_with_file`
391 9314b9f4 2020-11-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
393 9314b9f4 2020-11-06 stsp if [ "$ret" != "0" ]; then
394 9314b9f4 2020-11-06 stsp echo "checkout failed unexpectedly" >&2
395 9314b9f4 2020-11-06 stsp test_done "$testroot" "$ret"
399 9314b9f4 2020-11-06 stsp (cd $testroot/wt && ln -s alpha alpha.link)
400 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got add alpha alpha.link >/dev/null)
401 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got commit -m "add regular file and symlink" \
402 9314b9f4 2020-11-06 stsp >/dev/null)
404 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got br replace_symlink_with_file >/dev/null)
405 9314b9f4 2020-11-06 stsp (cd $testroot/wt && rm alpha.link >/dev/null)
406 9314b9f4 2020-11-06 stsp (cd $testroot/wt && cp alpha alpha.link)
407 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got stage alpha.link >/dev/null)
408 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got commit -m "replace symlink" >/dev/null)
410 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got up -b master >/dev/null)
411 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got integrate replace_symlink_with_file \
412 f6d8c0ac 2020-11-09 stsp > $testroot/stdout)
414 f6d8c0ac 2020-11-09 stsp echo "U alpha.link" > $testroot/stdout.expected
415 f6d8c0ac 2020-11-09 stsp echo -n "Integrated refs/heads/replace_symlink_with_file " \
416 f6d8c0ac 2020-11-09 stsp >> $testroot/stdout.expected
417 f6d8c0ac 2020-11-09 stsp echo "into refs/heads/master" >> $testroot/stdout.expected
418 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
420 9314b9f4 2020-11-06 stsp if [ "$ret" != "0" ]; then
421 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
422 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
426 f6d8c0ac 2020-11-09 stsp if [ -h $testroot/wt/alpha.link ]; then
427 f6d8c0ac 2020-11-09 stsp echo "alpha.link is still a symlink"
428 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "1"
432 f6d8c0ac 2020-11-09 stsp echo "alpha" > $testroot/content.expected
433 f6d8c0ac 2020-11-09 stsp cat $testroot/wt/alpha.link > $testroot/content
435 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/content.expected $testroot/content
437 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
438 f6d8c0ac 2020-11-09 stsp diff -u $testroot/content.expected $testroot/content
440 9314b9f4 2020-11-06 stsp test_done "$testroot" "$ret"
443 f6d8c0ac 2020-11-09 stsp test_integrate_replace_file_with_symlink() {
444 f6d8c0ac 2020-11-09 stsp local testroot=`test_init integrate_replace_file_with_symlink`
446 f6d8c0ac 2020-11-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
448 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
449 f6d8c0ac 2020-11-09 stsp echo "checkout failed unexpectedly" >&2
450 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
454 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got br replace_file_with_symlink >/dev/null)
455 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && rm alpha)
456 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && ln -s beta alpha)
457 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got commit -m "replace regular file with symlink" \
458 f6d8c0ac 2020-11-09 stsp >/dev/null)
460 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got up -b master >/dev/null)
461 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got integrate replace_file_with_symlink \
462 f6d8c0ac 2020-11-09 stsp > $testroot/stdout)
464 f6d8c0ac 2020-11-09 stsp echo "U alpha" > $testroot/stdout.expected
465 f6d8c0ac 2020-11-09 stsp echo -n "Integrated refs/heads/replace_file_with_symlink " \
466 f6d8c0ac 2020-11-09 stsp >> $testroot/stdout.expected
467 f6d8c0ac 2020-11-09 stsp echo "into refs/heads/master" >> $testroot/stdout.expected
468 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
470 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
471 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
472 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
476 f6d8c0ac 2020-11-09 stsp if ! [ -h $testroot/wt/alpha ]; then
477 f6d8c0ac 2020-11-09 stsp echo "alpha is not a symlink"
478 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "1"
482 f6d8c0ac 2020-11-09 stsp readlink $testroot/wt/alpha > $testroot/stdout
483 f6d8c0ac 2020-11-09 stsp echo "beta" > $testroot/stdout.expected
484 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
486 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
487 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
489 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
492 7fb414ae 2020-08-08 stsp test_parseargs "$@"
493 2822a352 2019-10-15 stsp run_test test_integrate_basic
494 2822a352 2019-10-15 stsp run_test test_integrate_requires_rebase_first
495 2822a352 2019-10-15 stsp run_test test_integrate_path_prefix
496 3aef623b 2019-10-15 stsp run_test test_integrate_backwards_in_time
497 f6d8c0ac 2020-11-09 stsp run_test test_integrate_replace_symlink_with_file
498 f6d8c0ac 2020-11-09 stsp run_test test_integrate_replace_file_with_symlink