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 6e210706 2021-01-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
137 6e210706 2021-01-22 stsp if [ "$ret" != "0" ]; then
138 6e210706 2021-01-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
139 6e210706 2021-01-22 stsp test_done "$testroot" "$ret"
143 6e210706 2021-01-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
144 6e210706 2021-01-22 stsp echo "Already up-to-date" > $testroot/stdout.expected
145 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
147 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
148 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
150 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
153 f6cae3ed 2020-09-13 naddy test_integrate_requires_rebase_first() {
154 2822a352 2019-10-15 stsp local testroot=`test_init integrate_requires_rebase_first`
155 2822a352 2019-10-15 stsp local init_commit=`git_show_head $testroot/repo`
157 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
158 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
159 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
161 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
162 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
163 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
164 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
165 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
167 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
168 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
170 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
171 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
172 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
173 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
175 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
176 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
177 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
179 2822a352 2019-10-15 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
181 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
182 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
186 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch \
187 2822a352 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
189 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
190 2822a352 2019-10-15 stsp echo "got integrate succeeded unexpectedly"
191 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
195 2822a352 2019-10-15 stsp echo -n > $testroot/stdout.expected
196 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
198 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
199 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
200 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
204 2822a352 2019-10-15 stsp echo "got: specified branch must be rebased first" \
205 2822a352 2019-10-15 stsp > $testroot/stderr.expected
206 2822a352 2019-10-15 stsp cmp -s $testroot/stderr.expected $testroot/stderr
208 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
209 2822a352 2019-10-15 stsp diff -u $testroot/stderr.expected $testroot/stderr
210 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
214 2822a352 2019-10-15 stsp (cd $testroot/repo && got log -c master | \
215 2822a352 2019-10-15 stsp grep ^commit > $testroot/stdout)
216 2822a352 2019-10-15 stsp echo "commit $master_commit (master)" > $testroot/stdout.expected
217 2822a352 2019-10-15 stsp echo "commit $init_commit" >> $testroot/stdout.expected
218 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
220 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
221 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
222 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
226 2822a352 2019-10-15 stsp (cd $testroot/repo && got log -c newbranch | \
227 2822a352 2019-10-15 stsp grep ^commit > $testroot/stdout)
228 2822a352 2019-10-15 stsp echo "commit $new_commit2 (newbranch)" \
229 2822a352 2019-10-15 stsp > $testroot/stdout.expected
230 2822a352 2019-10-15 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
231 2822a352 2019-10-15 stsp echo "commit $init_commit" >> $testroot/stdout.expected
232 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
234 8b692cd0 2019-10-21 stsp if [ "$ret" != "0" ]; then
235 8b692cd0 2019-10-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
236 8b692cd0 2019-10-21 stsp test_done "$testroot" "$ret"
240 8b692cd0 2019-10-21 stsp (cd $testroot/repo && got branch -l > $testroot/stdout)
242 8b692cd0 2019-10-21 stsp if [ "$ret" != "0" ]; then
243 8b692cd0 2019-10-21 stsp echo "got rebase failed unexpectedly"
244 8b692cd0 2019-10-21 stsp test_done "$testroot" "$ret"
248 8b692cd0 2019-10-21 stsp echo " master: $master_commit" > $testroot/stdout.expected
249 8b692cd0 2019-10-21 stsp echo " newbranch: $new_commit2" >> $testroot/stdout.expected
250 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
252 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
253 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
255 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
258 f6cae3ed 2020-09-13 naddy test_integrate_path_prefix() {
259 2822a352 2019-10-15 stsp local testroot=`test_init integrate_path_prefix`
261 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
262 2822a352 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
263 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
265 2822a352 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
266 2822a352 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
267 2822a352 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
268 2822a352 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
269 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
271 2822a352 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
272 2822a352 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
274 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
275 2822a352 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
276 2822a352 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
277 2822a352 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
279 2822a352 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
281 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
282 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
286 2822a352 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
288 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
289 2822a352 2019-10-15 stsp echo "got rebase failed unexpectedly"
290 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
294 2822a352 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
295 2822a352 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
296 2822a352 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
298 2822a352 2019-10-15 stsp rm -r $testroot/wt
299 2822a352 2019-10-15 stsp got checkout -b master -p epsilon $testroot/repo $testroot/wt \
300 2822a352 2019-10-15 stsp > /dev/null
302 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
303 2822a352 2019-10-15 stsp echo "got checkout failed unexpectedly"
304 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
308 2822a352 2019-10-15 stsp (cd $testroot/wt && got integrate newbranch > $testroot/stdout)
310 2822a352 2019-10-15 stsp echo "A new" > $testroot/stdout.expected
311 2822a352 2019-10-15 stsp echo "Integrated refs/heads/newbranch into refs/heads/master" \
312 2822a352 2019-10-15 stsp >> $testroot/stdout.expected
313 2822a352 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
315 2822a352 2019-10-15 stsp if [ "$ret" != "0" ]; then
316 2822a352 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
318 2822a352 2019-10-15 stsp test_done "$testroot" "$ret"
321 f6cae3ed 2020-09-13 naddy test_integrate_backwards_in_time() {
322 3aef623b 2019-10-15 stsp local testroot=`test_init integrate_backwards_in_time`
324 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q -b newbranch)
325 3aef623b 2019-10-15 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
326 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
328 3aef623b 2019-10-15 stsp echo "modified alpha on branch" > $testroot/repo/alpha
329 3aef623b 2019-10-15 stsp (cd $testroot/repo && git rm -q beta)
330 3aef623b 2019-10-15 stsp echo "new file on branch" > $testroot/repo/epsilon/new
331 3aef623b 2019-10-15 stsp (cd $testroot/repo && git add epsilon/new)
332 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
334 3aef623b 2019-10-15 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
335 3aef623b 2019-10-15 stsp local orig_commit2=`git_show_head $testroot/repo`
337 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q master)
338 3aef623b 2019-10-15 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
339 3aef623b 2019-10-15 stsp git_commit $testroot/repo -m "committing to zeta on master"
340 3aef623b 2019-10-15 stsp local master_commit=`git_show_head $testroot/repo`
342 3aef623b 2019-10-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
344 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
345 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
349 3aef623b 2019-10-15 stsp (cd $testroot/wt && got rebase newbranch > /dev/null)
351 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
352 3aef623b 2019-10-15 stsp echo "got rebase failed unexpectedly"
353 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
357 3aef623b 2019-10-15 stsp (cd $testroot/repo && git checkout -q newbranch)
358 3aef623b 2019-10-15 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
359 3aef623b 2019-10-15 stsp local new_commit2=`git_show_head $testroot/repo`
361 3aef623b 2019-10-15 stsp # attempt to integrate master into newbranch (wrong way around)
362 3aef623b 2019-10-15 stsp (cd $testroot/wt && got update -b newbranch > /dev/null)
364 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
365 3aef623b 2019-10-15 stsp echo "got update failed unexpectedly"
366 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
370 3aef623b 2019-10-15 stsp (cd $testroot/wt && got integrate master \
371 3aef623b 2019-10-15 stsp > $testroot/stdout 2> $testroot/stderr)
373 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
374 3aef623b 2019-10-15 stsp echo "got integrate succeeded unexpectedly"
375 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
379 3aef623b 2019-10-15 stsp echo -n > $testroot/stdout.expected
380 3aef623b 2019-10-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
382 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
383 3aef623b 2019-10-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
384 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
388 3aef623b 2019-10-15 stsp echo "got: specified branch must be rebased first" \
389 3aef623b 2019-10-15 stsp > $testroot/stderr.expected
390 3aef623b 2019-10-15 stsp cmp -s $testroot/stderr.expected $testroot/stderr
392 3aef623b 2019-10-15 stsp if [ "$ret" != "0" ]; then
393 3aef623b 2019-10-15 stsp diff -u $testroot/stderr.expected $testroot/stderr
395 3aef623b 2019-10-15 stsp test_done "$testroot" "$ret"
398 f6d8c0ac 2020-11-09 stsp test_integrate_replace_symlink_with_file() {
399 f6d8c0ac 2020-11-09 stsp local testroot=`test_init integrate_replace_symlink_with_file`
401 9314b9f4 2020-11-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
403 9314b9f4 2020-11-06 stsp if [ "$ret" != "0" ]; then
404 9314b9f4 2020-11-06 stsp echo "checkout failed unexpectedly" >&2
405 9314b9f4 2020-11-06 stsp test_done "$testroot" "$ret"
409 9314b9f4 2020-11-06 stsp (cd $testroot/wt && ln -s alpha alpha.link)
410 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got add alpha alpha.link >/dev/null)
411 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got commit -m "add regular file and symlink" \
412 9314b9f4 2020-11-06 stsp >/dev/null)
414 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got br replace_symlink_with_file >/dev/null)
415 9314b9f4 2020-11-06 stsp (cd $testroot/wt && rm alpha.link >/dev/null)
416 9314b9f4 2020-11-06 stsp (cd $testroot/wt && cp alpha alpha.link)
417 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got stage alpha.link >/dev/null)
418 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got commit -m "replace symlink" >/dev/null)
420 9314b9f4 2020-11-06 stsp (cd $testroot/wt && got up -b master >/dev/null)
421 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got integrate replace_symlink_with_file \
422 f6d8c0ac 2020-11-09 stsp > $testroot/stdout)
424 f6d8c0ac 2020-11-09 stsp echo "U alpha.link" > $testroot/stdout.expected
425 f6d8c0ac 2020-11-09 stsp echo -n "Integrated refs/heads/replace_symlink_with_file " \
426 f6d8c0ac 2020-11-09 stsp >> $testroot/stdout.expected
427 f6d8c0ac 2020-11-09 stsp echo "into refs/heads/master" >> $testroot/stdout.expected
428 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
430 9314b9f4 2020-11-06 stsp if [ "$ret" != "0" ]; then
431 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
432 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
436 f6d8c0ac 2020-11-09 stsp if [ -h $testroot/wt/alpha.link ]; then
437 f6d8c0ac 2020-11-09 stsp echo "alpha.link is still a symlink"
438 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "1"
442 f6d8c0ac 2020-11-09 stsp echo "alpha" > $testroot/content.expected
443 f6d8c0ac 2020-11-09 stsp cat $testroot/wt/alpha.link > $testroot/content
445 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/content.expected $testroot/content
447 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
448 f6d8c0ac 2020-11-09 stsp diff -u $testroot/content.expected $testroot/content
450 9314b9f4 2020-11-06 stsp test_done "$testroot" "$ret"
453 f6d8c0ac 2020-11-09 stsp test_integrate_replace_file_with_symlink() {
454 f6d8c0ac 2020-11-09 stsp local testroot=`test_init integrate_replace_file_with_symlink`
456 f6d8c0ac 2020-11-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
458 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
459 f6d8c0ac 2020-11-09 stsp echo "checkout failed unexpectedly" >&2
460 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
464 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got br replace_file_with_symlink >/dev/null)
465 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && rm alpha)
466 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && ln -s beta alpha)
467 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got commit -m "replace regular file with symlink" \
468 f6d8c0ac 2020-11-09 stsp >/dev/null)
470 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got up -b master >/dev/null)
471 f6d8c0ac 2020-11-09 stsp (cd $testroot/wt && got integrate replace_file_with_symlink \
472 f6d8c0ac 2020-11-09 stsp > $testroot/stdout)
474 f6d8c0ac 2020-11-09 stsp echo "U alpha" > $testroot/stdout.expected
475 f6d8c0ac 2020-11-09 stsp echo -n "Integrated refs/heads/replace_file_with_symlink " \
476 f6d8c0ac 2020-11-09 stsp >> $testroot/stdout.expected
477 f6d8c0ac 2020-11-09 stsp echo "into refs/heads/master" >> $testroot/stdout.expected
478 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
480 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
481 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
482 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
486 f6d8c0ac 2020-11-09 stsp if ! [ -h $testroot/wt/alpha ]; then
487 f6d8c0ac 2020-11-09 stsp echo "alpha is not a symlink"
488 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "1"
492 f6d8c0ac 2020-11-09 stsp readlink $testroot/wt/alpha > $testroot/stdout
493 f6d8c0ac 2020-11-09 stsp echo "beta" > $testroot/stdout.expected
494 f6d8c0ac 2020-11-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
496 f6d8c0ac 2020-11-09 stsp if [ "$ret" != "0" ]; then
497 f6d8c0ac 2020-11-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
499 f6d8c0ac 2020-11-09 stsp test_done "$testroot" "$ret"
502 7fb414ae 2020-08-08 stsp test_parseargs "$@"
503 2822a352 2019-10-15 stsp run_test test_integrate_basic
504 2822a352 2019-10-15 stsp run_test test_integrate_requires_rebase_first
505 2822a352 2019-10-15 stsp run_test test_integrate_path_prefix
506 3aef623b 2019-10-15 stsp run_test test_integrate_backwards_in_time
507 f6d8c0ac 2020-11-09 stsp run_test test_integrate_replace_symlink_with_file
508 f6d8c0ac 2020-11-09 stsp run_test test_integrate_replace_file_with_symlink