3 f259c4c1 2021-09-24 stsp # Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
5 f259c4c1 2021-09-24 stsp # Permission to use, copy, modify, and distribute this software for any
6 f259c4c1 2021-09-24 stsp # purpose with or without fee is hereby granted, provided that the above
7 f259c4c1 2021-09-24 stsp # copyright notice and this permission notice appear in all copies.
9 f259c4c1 2021-09-24 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 f259c4c1 2021-09-24 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 f259c4c1 2021-09-24 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 f259c4c1 2021-09-24 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 f259c4c1 2021-09-24 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 f259c4c1 2021-09-24 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 f259c4c1 2021-09-24 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 f259c4c1 2021-09-24 stsp . ./common.sh
19 f259c4c1 2021-09-24 stsp test_merge_basic() {
20 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_basic`
21 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
22 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
24 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
25 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
26 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
27 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
29 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
30 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
31 f259c4c1 2021-09-24 stsp local branch_commit1=`git_show_branch_head $testroot/repo newbranch`
32 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
33 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "removing beta on newbranch"
34 f259c4c1 2021-09-24 stsp local branch_commit2=`git_show_branch_head $testroot/repo newbranch`
35 f259c4c1 2021-09-24 stsp echo "new file on branch" > $testroot/repo/epsilon/new
36 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon/new
37 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "adding new file on newbranch"
38 f259c4c1 2021-09-24 stsp local branch_commit3=`git_show_branch_head $testroot/repo newbranch`
39 f73bf5bd 2023-10-01 naddy (cd $testroot/repo && ln -s alpha symlink)
40 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add symlink
41 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "adding symlink on newbranch"
42 f259c4c1 2021-09-24 stsp local branch_commit4=`git_show_branch_head $testroot/repo newbranch`
43 5267b9e4 2021-09-26 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
44 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add dotgotbar.link
45 5267b9e4 2021-09-26 stsp git_commit $testroot/repo -m "adding a bad symlink on newbranch"
46 5267b9e4 2021-09-26 stsp local branch_commit5=`git_show_branch_head $testroot/repo newbranch`
48 f259c4c1 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
50 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
51 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
52 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
56 179f9db0 2023-06-20 falsifian # create a divergent commit
57 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
58 f259c4c1 2021-09-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
59 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
60 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
62 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
63 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
64 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
66 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
67 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
68 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
71 f259c4c1 2021-09-24 stsp echo -n "got: work tree must be updated before it can be used " \
72 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
73 f259c4c1 2021-09-24 stsp echo "to merge a branch" >> $testroot/stderr.expected
74 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
76 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
77 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
78 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
82 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
84 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
85 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
86 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
90 5e91dae4 2022-08-30 stsp # must not use a mixed-commit work tree with 'got merge'
91 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update -c $commit0 alpha > /dev/null)
93 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
94 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
95 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
98 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
99 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
101 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
102 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
103 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
106 f259c4c1 2021-09-24 stsp echo -n "got: work tree contains files from multiple base commits; " \
107 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
108 f259c4c1 2021-09-24 stsp echo "the entire work tree must be updated first" \
109 f259c4c1 2021-09-24 stsp >> $testroot/stderr.expected
110 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
112 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
113 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
114 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
118 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
120 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
121 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
122 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
126 5e91dae4 2022-08-30 stsp # must not have staged files with 'got merge'
127 f259c4c1 2021-09-24 stsp echo "modified file alpha" > $testroot/wt/alpha
128 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got stage alpha > /dev/null)
130 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
131 f259c4c1 2021-09-24 stsp echo "got stage failed unexpectedly" >&2
132 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
135 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
136 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
138 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
139 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
140 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
143 f259c4c1 2021-09-24 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
144 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
146 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
147 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
148 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
151 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got unstage alpha > /dev/null)
153 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
154 f259c4c1 2021-09-24 stsp echo "got unstage failed unexpectedly" >&2
155 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
159 5e91dae4 2022-08-30 stsp # must not have local changes with 'got merge'
160 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
161 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
163 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
164 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
165 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
168 f259c4c1 2021-09-24 stsp echo -n "got: work tree contains local changes; " \
169 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
170 f259c4c1 2021-09-24 stsp echo "these changes must be committed or reverted first" \
171 f259c4c1 2021-09-24 stsp >> $testroot/stderr.expected
172 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
174 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
175 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
176 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
180 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got revert alpha > /dev/null)
182 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
183 f259c4c1 2021-09-24 stsp echo "got revert failed unexpectedly" >&2
184 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
188 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch > $testroot/stdout)
190 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
191 f259c4c1 2021-09-24 stsp echo "got merge failed unexpectedly" >&2
192 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
196 f259c4c1 2021-09-24 stsp local merge_commit=`git_show_head $testroot/repo`
198 f259c4c1 2021-09-24 stsp echo "G alpha" >> $testroot/stdout.expected
199 f259c4c1 2021-09-24 stsp echo "D beta" >> $testroot/stdout.expected
200 5267b9e4 2021-09-26 stsp echo "A dotgotbar.link" >> $testroot/stdout.expected
201 f259c4c1 2021-09-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
202 f259c4c1 2021-09-24 stsp echo "G gamma/delta" >> $testroot/stdout.expected
203 f259c4c1 2021-09-24 stsp echo "A symlink" >> $testroot/stdout.expected
204 f259c4c1 2021-09-24 stsp echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
205 f259c4c1 2021-09-24 stsp >> $testroot/stdout.expected
206 f259c4c1 2021-09-24 stsp echo $merge_commit >> $testroot/stdout.expected
208 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
210 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
211 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
212 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
216 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/content.expected
217 f259c4c1 2021-09-24 stsp cat $testroot/wt/gamma/delta > $testroot/content
218 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
220 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
221 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
222 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
226 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/content.expected
227 f259c4c1 2021-09-24 stsp cat $testroot/wt/alpha > $testroot/content
228 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
230 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
231 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
232 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
236 f259c4c1 2021-09-24 stsp if [ -e $testroot/wt/beta ]; then
237 f259c4c1 2021-09-24 stsp echo "removed file beta still exists on disk" >&2
238 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
242 f259c4c1 2021-09-24 stsp echo "new file on branch" > $testroot/content.expected
243 f259c4c1 2021-09-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
244 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
246 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
247 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
248 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
252 5267b9e4 2021-09-26 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
253 5267b9e4 2021-09-26 stsp echo "dotgotbar.link is not a symlink"
254 5267b9e4 2021-09-26 stsp test_done "$testroot" "1"
258 f259c4c1 2021-09-24 stsp readlink $testroot/wt/symlink > $testroot/stdout
259 f259c4c1 2021-09-24 stsp echo "alpha" > $testroot/stdout.expected
260 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
262 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
263 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
264 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
268 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
270 f259c4c1 2021-09-24 stsp echo -n > $testroot/stdout.expected
271 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
274 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
275 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
279 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
280 f259c4c1 2021-09-24 stsp echo "commit $merge_commit (master)" > $testroot/stdout.expected
281 f259c4c1 2021-09-24 stsp echo "commit $master_commit" >> $testroot/stdout.expected
282 f259c4c1 2021-09-24 stsp echo "commit $commit0" >> $testroot/stdout.expected
283 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
285 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
286 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
287 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
291 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > $testroot/stdout)
293 5267b9e4 2021-09-26 stsp echo 'U dotgotbar.link' > $testroot/stdout.expected
294 5267b9e4 2021-09-26 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
295 5267b9e4 2021-09-26 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
296 5267b9e4 2021-09-26 stsp echo >> $testroot/stdout.expected
297 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
299 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
300 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
301 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
305 5267b9e4 2021-09-26 stsp # update has changed the bad symlink into a regular file
306 5267b9e4 2021-09-26 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
307 5267b9e4 2021-09-26 stsp echo "dotgotbar.link is a symlink"
308 5267b9e4 2021-09-26 stsp test_done "$testroot" "1"
312 f259c4c1 2021-09-24 stsp # We should have created a merge commit with two parents.
313 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got log -l1 | grep ^parent > $testroot/stdout)
314 f259c4c1 2021-09-24 stsp echo "parent 1: $master_commit" > $testroot/stdout.expected
315 5267b9e4 2021-09-26 stsp echo "parent 2: $branch_commit5" >> $testroot/stdout.expected
316 5267b9e4 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
318 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
319 5267b9e4 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
320 5267b9e4 2021-09-26 stsp test_done "$testroot" "$ret"
324 5267b9e4 2021-09-26 stsp got tree -r $testroot/repo -c $merge_commit -R > $testroot/stdout
326 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
327 5267b9e4 2021-09-26 stsp echo "got tree failed unexpectedly" >&2
328 5267b9e4 2021-09-26 stsp test_done "$testroot" "$ret"
332 5267b9e4 2021-09-26 stsp # bad symlink dotgotbar.link appears as a symlink in the merge commit:
333 5267b9e4 2021-09-26 stsp cat > $testroot/stdout.expected <<EOF
335 5267b9e4 2021-09-26 stsp dotgotbar.link@ -> .got/bar
337 5267b9e4 2021-09-26 stsp epsilon/new
338 5267b9e4 2021-09-26 stsp epsilon/zeta
340 5267b9e4 2021-09-26 stsp gamma/delta
341 5267b9e4 2021-09-26 stsp symlink@ -> alpha
343 179f9db0 2023-06-20 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
344 179f9db0 2023-06-20 falsifian ret=$?
345 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
346 179f9db0 2023-06-20 falsifian diff -u $testroot/stdout.expected $testroot/stdout
348 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
351 179f9db0 2023-06-20 falsifian test_merge_forward() {
352 179f9db0 2023-06-20 falsifian local testroot=`test_init merge_forward`
353 179f9db0 2023-06-20 falsifian local commit0=`git_show_head $testroot/repo`
355 179f9db0 2023-06-20 falsifian # Create a commit before branching, which will be used to help test
356 179f9db0 2023-06-20 falsifian # preconditions for "got merge".
357 179f9db0 2023-06-20 falsifian echo "modified alpha" > $testroot/repo/alpha
358 179f9db0 2023-06-20 falsifian git_commit $testroot/repo -m "common commit"
359 179f9db0 2023-06-20 falsifian local commit1=`git_show_head $testroot/repo`
361 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
362 179f9db0 2023-06-20 falsifian echo "modified beta on branch" > $testroot/repo/beta
363 179f9db0 2023-06-20 falsifian git_commit $testroot/repo -m "committing to beta on newbranch"
364 179f9db0 2023-06-20 falsifian local commit2=`git_show_head $testroot/repo`
366 179f9db0 2023-06-20 falsifian got checkout -b master $testroot/repo $testroot/wt > /dev/null
367 179f9db0 2023-06-20 falsifian ret=$?
368 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
369 179f9db0 2023-06-20 falsifian echo "got checkout failed unexpectedly" >&2
370 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
371 179f9db0 2023-06-20 falsifian return 1
374 179f9db0 2023-06-20 falsifian # must not use a mixed-commit work tree with 'got merge'
375 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got update -c $commit0 alpha > /dev/null)
376 179f9db0 2023-06-20 falsifian ret=$?
377 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
378 179f9db0 2023-06-20 falsifian echo "got update failed unexpectedly" >&2
379 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
380 179f9db0 2023-06-20 falsifian return 1
382 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got merge newbranch \
383 179f9db0 2023-06-20 falsifian > $testroot/stdout 2> $testroot/stderr)
384 179f9db0 2023-06-20 falsifian ret=$?
385 179f9db0 2023-06-20 falsifian if [ $ret -eq 0 ]; then
386 179f9db0 2023-06-20 falsifian echo "got merge succeeded unexpectedly" >&2
387 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
388 179f9db0 2023-06-20 falsifian return 1
390 179f9db0 2023-06-20 falsifian echo -n "got: work tree contains files from multiple base commits; " \
391 179f9db0 2023-06-20 falsifian > $testroot/stderr.expected
392 179f9db0 2023-06-20 falsifian echo "the entire work tree must be updated first" \
393 179f9db0 2023-06-20 falsifian >> $testroot/stderr.expected
394 179f9db0 2023-06-20 falsifian cmp -s $testroot/stderr.expected $testroot/stderr
395 179f9db0 2023-06-20 falsifian ret=$?
396 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
397 179f9db0 2023-06-20 falsifian diff -u $testroot/stderr.expected $testroot/stderr
398 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
399 179f9db0 2023-06-20 falsifian return 1
402 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got update > /dev/null)
403 179f9db0 2023-06-20 falsifian ret=$?
404 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
405 179f9db0 2023-06-20 falsifian echo "got update failed unexpectedly" >&2
406 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
407 179f9db0 2023-06-20 falsifian return 1
410 179f9db0 2023-06-20 falsifian # 'got merge -n' refuses to fast-forward
411 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got merge -n newbranch \
412 179f9db0 2023-06-20 falsifian > $testroot/stdout 2> $testroot/stderr)
413 179f9db0 2023-06-20 falsifian ret=$?
414 179f9db0 2023-06-20 falsifian if [ $ret -eq 0 ]; then
415 179f9db0 2023-06-20 falsifian echo "got merge succeeded unexpectedly" >&2
416 179f9db0 2023-06-20 falsifian test_done "$testroot" "1"
417 179f9db0 2023-06-20 falsifian return 1
420 f25e229e 2023-06-22 stsp echo -n "got: there are no changes to merge since " \
421 f25e229e 2023-06-22 stsp > $testroot/stderr.expected
422 f25e229e 2023-06-22 stsp echo -n "refs/heads/newbranch is already based on " \
423 179f9db0 2023-06-20 falsifian >> $testroot/stderr.expected
424 f25e229e 2023-06-22 stsp echo -n "refs/heads/master; merge cannot be interrupted " \
425 f25e229e 2023-06-22 stsp >> $testroot/stderr.expected
426 f25e229e 2023-06-22 stsp echo "for amending; -n: option cannot be used" \
427 f25e229e 2023-06-22 stsp >> $testroot/stderr.expected
429 179f9db0 2023-06-20 falsifian cmp -s $testroot/stderr.expected $testroot/stderr
430 179f9db0 2023-06-20 falsifian ret=$?
431 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
432 179f9db0 2023-06-20 falsifian diff -u $testroot/stderr.expected $testroot/stderr
433 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
434 179f9db0 2023-06-20 falsifian return 1
437 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got merge newbranch \
438 179f9db0 2023-06-20 falsifian > $testroot/stdout 2> $testroot/stderr)
439 179f9db0 2023-06-20 falsifian ret=$?
440 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
441 179f9db0 2023-06-20 falsifian echo "got merge failed unexpectedly" >&2
442 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
443 179f9db0 2023-06-20 falsifian return 1
446 179f9db0 2023-06-20 falsifian echo "Forwarding refs/heads/master to refs/heads/newbranch" \
447 179f9db0 2023-06-20 falsifian > $testroot/stdout.expected
448 179f9db0 2023-06-20 falsifian echo "U beta" >> $testroot/stdout.expected
449 179f9db0 2023-06-20 falsifian echo "Updated to commit $commit2" \
450 179f9db0 2023-06-20 falsifian >> $testroot/stdout.expected
451 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
453 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
454 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
455 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
456 179f9db0 2023-06-20 falsifian return 1
459 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got log | grep ^commit > $testroot/stdout)
460 179f9db0 2023-06-20 falsifian echo -n "commit $commit2 " > $testroot/stdout.expected
461 179f9db0 2023-06-20 falsifian echo "(master, newbranch)" >> $testroot/stdout.expected
462 179f9db0 2023-06-20 falsifian echo "commit $commit1" >> $testroot/stdout.expected
463 179f9db0 2023-06-20 falsifian echo "commit $commit0" >> $testroot/stdout.expected
464 481cdc74 2023-07-01 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
465 481cdc74 2023-07-01 falsifian ret=$?
466 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
467 481cdc74 2023-07-01 falsifian diff -u $testroot/stdout.expected $testroot/stdout
468 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
469 481cdc74 2023-07-01 falsifian return 1
471 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
474 481cdc74 2023-07-01 falsifian test_merge_forward_commit() {
475 481cdc74 2023-07-01 falsifian local testroot=`test_init merge_forward_commit`
476 481cdc74 2023-07-01 falsifian local commit0=`git_show_head $testroot/repo`
478 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
479 481cdc74 2023-07-01 falsifian echo "modified alpha on branch" > $testroot/repo/alpha
480 481cdc74 2023-07-01 falsifian git_commit $testroot/repo -m "committing to alpha on newbranch"
481 481cdc74 2023-07-01 falsifian local commit1=`git_show_head $testroot/repo`
483 481cdc74 2023-07-01 falsifian got checkout -b master $testroot/repo $testroot/wt > /dev/null
484 481cdc74 2023-07-01 falsifian ret=$?
485 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
486 481cdc74 2023-07-01 falsifian echo "got checkout failed unexpectedly" >&2
487 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
488 481cdc74 2023-07-01 falsifian return 1
491 481cdc74 2023-07-01 falsifian (cd $testroot/wt && got merge -M newbranch > $testroot/stdout)
492 481cdc74 2023-07-01 falsifian ret=$?
493 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
494 481cdc74 2023-07-01 falsifian echo "got merge failed unexpectedly" >&2
495 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
496 481cdc74 2023-07-01 falsifian return 1
499 481cdc74 2023-07-01 falsifian local merge_commit=`git_show_branch_head $testroot/repo master`
501 481cdc74 2023-07-01 falsifian echo "G alpha" >> $testroot/stdout.expected
502 481cdc74 2023-07-01 falsifian echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
503 481cdc74 2023-07-01 falsifian >> $testroot/stdout.expected
504 481cdc74 2023-07-01 falsifian echo $merge_commit >> $testroot/stdout.expected
506 481cdc74 2023-07-01 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
507 481cdc74 2023-07-01 falsifian ret=$?
508 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
509 481cdc74 2023-07-01 falsifian diff -u $testroot/stdout.expected $testroot/stdout
510 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
511 481cdc74 2023-07-01 falsifian return 1
514 481cdc74 2023-07-01 falsifian # We should have created a merge commit with two parents.
515 481cdc74 2023-07-01 falsifian (cd $testroot/wt && got log -l1 | grep ^parent > $testroot/stdout)
516 481cdc74 2023-07-01 falsifian echo "parent 1: $commit0" > $testroot/stdout.expected
517 481cdc74 2023-07-01 falsifian echo "parent 2: $commit1" >> $testroot/stdout.expected
518 481cdc74 2023-07-01 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
519 481cdc74 2023-07-01 falsifian ret=$?
520 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
521 481cdc74 2023-07-01 falsifian diff -u $testroot/stdout.expected $testroot/stdout
522 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
523 481cdc74 2023-07-01 falsifian return 1
526 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
529 481cdc74 2023-07-01 falsifian test_merge_forward_interrupt() {
530 481cdc74 2023-07-01 falsifian # Test -M and -n options together.
531 481cdc74 2023-07-01 falsifian local testroot=`test_init merge_forward_commit`
532 481cdc74 2023-07-01 falsifian local commit0=`git_show_head $testroot/repo`
534 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
535 481cdc74 2023-07-01 falsifian echo "modified alpha on branch" > $testroot/repo/alpha
536 481cdc74 2023-07-01 falsifian git_commit $testroot/repo -m "committing to alpha on newbranch"
537 481cdc74 2023-07-01 falsifian local commit1=`git_show_head $testroot/repo`
539 481cdc74 2023-07-01 falsifian got checkout -b master $testroot/repo $testroot/wt > /dev/null
540 481cdc74 2023-07-01 falsifian ret=$?
541 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
542 481cdc74 2023-07-01 falsifian echo "got checkout failed unexpectedly" >&2
543 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
544 481cdc74 2023-07-01 falsifian return 1
547 481cdc74 2023-07-01 falsifian (cd $testroot/wt && got merge -M -n newbranch > $testroot/stdout)
548 481cdc74 2023-07-01 falsifian ret=$?
549 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
550 481cdc74 2023-07-01 falsifian echo "got merge failed unexpectedly" >&2
551 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
552 481cdc74 2023-07-01 falsifian return 1
555 481cdc74 2023-07-01 falsifian echo "G alpha" > $testroot/stdout.expected
556 481cdc74 2023-07-01 falsifian echo "Merge of refs/heads/newbranch interrupted on request" \
557 481cdc74 2023-07-01 falsifian >> $testroot/stdout.expected
558 481cdc74 2023-07-01 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
559 481cdc74 2023-07-01 falsifian ret=$?
560 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
561 481cdc74 2023-07-01 falsifian diff -u $testroot/stdout.expected $testroot/stdout
562 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
563 481cdc74 2023-07-01 falsifian return 1
566 481cdc74 2023-07-01 falsifian # Continue the merge.
567 481cdc74 2023-07-01 falsifian (cd $testroot/wt && got merge -c > $testroot/stdout)
568 481cdc74 2023-07-01 falsifian ret=$?
569 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
570 481cdc74 2023-07-01 falsifian echo "got merge failed unexpectedly" >&2
571 481cdc74 2023-07-01 falsifian test_done "$testroot" "$ret"
572 481cdc74 2023-07-01 falsifian return 1
575 481cdc74 2023-07-01 falsifian local merge_commit=`git_show_branch_head $testroot/repo master`
577 481cdc74 2023-07-01 falsifian echo "M alpha" > $testroot/stdout.expected
578 481cdc74 2023-07-01 falsifian echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
579 481cdc74 2023-07-01 falsifian >> $testroot/stdout.expected
580 481cdc74 2023-07-01 falsifian echo $merge_commit >> $testroot/stdout.expected
582 179f9db0 2023-06-20 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
583 179f9db0 2023-06-20 falsifian ret=$?
584 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
585 179f9db0 2023-06-20 falsifian diff -u $testroot/stdout.expected $testroot/stdout
586 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
587 179f9db0 2023-06-20 falsifian return 1
590 481cdc74 2023-07-01 falsifian # We should have created a merge commit with two parents.
591 481cdc74 2023-07-01 falsifian (cd $testroot/wt && got log -l1 | grep ^parent > $testroot/stdout)
592 481cdc74 2023-07-01 falsifian echo "parent 1: $commit0" > $testroot/stdout.expected
593 481cdc74 2023-07-01 falsifian echo "parent 2: $commit1" >> $testroot/stdout.expected
594 481cdc74 2023-07-01 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
595 481cdc74 2023-07-01 falsifian ret=$?
596 481cdc74 2023-07-01 falsifian if [ $ret -ne 0 ]; then
597 481cdc74 2023-07-01 falsifian diff -u $testroot/stdout.expected $testroot/stdout
599 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
602 179f9db0 2023-06-20 falsifian test_merge_backward() {
603 179f9db0 2023-06-20 falsifian local testroot=`test_init merge_backward`
604 179f9db0 2023-06-20 falsifian local commit0=`git_show_head $testroot/repo`
606 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
607 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
608 179f9db0 2023-06-20 falsifian echo "modified alpha on master" > $testroot/repo/alpha
609 179f9db0 2023-06-20 falsifian git_commit $testroot/repo -m "committing to alpha on master"
611 179f9db0 2023-06-20 falsifian got checkout -b master $testroot/repo $testroot/wt > /dev/null
612 179f9db0 2023-06-20 falsifian ret=$?
613 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
614 179f9db0 2023-06-20 falsifian echo "got checkout failed unexpectedly" >&2
615 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
616 179f9db0 2023-06-20 falsifian return 1
619 179f9db0 2023-06-20 falsifian (cd $testroot/wt && got merge newbranch \
620 179f9db0 2023-06-20 falsifian > $testroot/stdout 2> $testroot/stderr)
621 179f9db0 2023-06-20 falsifian ret=$?
622 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
623 179f9db0 2023-06-20 falsifian echo "got merge failed unexpectedly" >&2
624 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
625 179f9db0 2023-06-20 falsifian return 1
627 179f9db0 2023-06-20 falsifian echo "Already up-to-date" > $testroot/stdout.expected
628 179f9db0 2023-06-20 falsifian cmp -s $testroot/stdout.expected $testroot/stdout
629 179f9db0 2023-06-20 falsifian ret=$?
630 179f9db0 2023-06-20 falsifian if [ $ret -ne 0 ]; then
631 179f9db0 2023-06-20 falsifian diff -u $testroot/stdout.expected $testroot/stdout
632 179f9db0 2023-06-20 falsifian test_done "$testroot" "$ret"
633 179f9db0 2023-06-20 falsifian return 1
635 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
638 f259c4c1 2021-09-24 stsp test_merge_continue() {
639 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_continue`
640 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
641 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
643 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
644 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
645 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
646 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
648 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
649 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
650 f259c4c1 2021-09-24 stsp local branch_commit1=`git_show_branch_head $testroot/repo newbranch`
651 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
652 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "removing beta on newbranch"
653 f259c4c1 2021-09-24 stsp local branch_commit2=`git_show_branch_head $testroot/repo newbranch`
654 f259c4c1 2021-09-24 stsp echo "new file on branch" > $testroot/repo/epsilon/new
655 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon/new
656 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "adding new file on newbranch"
657 f259c4c1 2021-09-24 stsp local branch_commit3=`git_show_branch_head $testroot/repo newbranch`
659 f259c4c1 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
661 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
662 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
663 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
667 f259c4c1 2021-09-24 stsp # create a conflicting commit
668 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
669 f259c4c1 2021-09-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
670 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on master"
671 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
673 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
674 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
676 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
677 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
678 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
682 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
683 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
685 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
686 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
687 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
691 f259c4c1 2021-09-24 stsp echo "C alpha" >> $testroot/stdout.expected
692 f259c4c1 2021-09-24 stsp echo "D beta" >> $testroot/stdout.expected
693 f259c4c1 2021-09-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
694 f259c4c1 2021-09-24 stsp echo "G gamma/delta" >> $testroot/stdout.expected
695 f259c4c1 2021-09-24 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
696 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
698 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
699 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
700 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
704 f259c4c1 2021-09-24 stsp echo "got: conflicts must be resolved before merging can continue" \
705 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
706 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
708 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
709 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
710 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
714 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
716 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
719 f4ab0e57 2024-03-28 stsp A epsilon/new
720 f4ab0e57 2024-03-28 stsp M gamma/delta
721 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
723 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
725 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
726 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
727 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
731 f259c4c1 2021-09-24 stsp echo '<<<<<<<' > $testroot/content.expected
732 f259c4c1 2021-09-24 stsp echo "modified alpha on master" >> $testroot/content.expected
733 f259c4c1 2021-09-24 stsp echo "||||||| 3-way merge base: commit $commit0" \
734 f259c4c1 2021-09-24 stsp >> $testroot/content.expected
735 f259c4c1 2021-09-24 stsp echo "alpha" >> $testroot/content.expected
736 f259c4c1 2021-09-24 stsp echo "=======" >> $testroot/content.expected
737 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" >> $testroot/content.expected
738 f259c4c1 2021-09-24 stsp echo ">>>>>>> merged change: commit $branch_commit3" \
739 f259c4c1 2021-09-24 stsp >> $testroot/content.expected
740 f259c4c1 2021-09-24 stsp cat $testroot/wt/alpha > $testroot/content
741 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
743 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
744 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
745 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
749 f259c4c1 2021-09-24 stsp # resolve the conflict
750 f259c4c1 2021-09-24 stsp echo "modified alpha by both branches" > $testroot/wt/alpha
752 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge -c > $testroot/stdout)
754 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
755 f259c4c1 2021-09-24 stsp echo "got merge failed unexpectedly" >&2
756 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
760 f259c4c1 2021-09-24 stsp local merge_commit=`git_show_head $testroot/repo`
762 0ff8d236 2021-09-28 stsp echo "M alpha" > $testroot/stdout.expected
763 0ff8d236 2021-09-28 stsp echo "D beta" >> $testroot/stdout.expected
764 0ff8d236 2021-09-28 stsp echo "A epsilon/new" >> $testroot/stdout.expected
765 0ff8d236 2021-09-28 stsp echo "M gamma/delta" >> $testroot/stdout.expected
766 f259c4c1 2021-09-24 stsp echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
767 0ff8d236 2021-09-28 stsp >> $testroot/stdout.expected
768 f259c4c1 2021-09-24 stsp echo $merge_commit >> $testroot/stdout.expected
770 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
772 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
773 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
774 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
778 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/content.expected
779 f259c4c1 2021-09-24 stsp cat $testroot/wt/gamma/delta > $testroot/content
780 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
782 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
783 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
784 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
788 f259c4c1 2021-09-24 stsp echo "modified alpha by both branches" > $testroot/content.expected
789 f259c4c1 2021-09-24 stsp cat $testroot/wt/alpha > $testroot/content
790 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
792 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
793 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
794 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
798 f259c4c1 2021-09-24 stsp if [ -e $testroot/wt/beta ]; then
799 f259c4c1 2021-09-24 stsp echo "removed file beta still exists on disk" >&2
800 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
804 f259c4c1 2021-09-24 stsp echo "new file on branch" > $testroot/content.expected
805 f259c4c1 2021-09-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
806 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
808 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
809 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
810 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
814 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
816 f259c4c1 2021-09-24 stsp echo -n > $testroot/stdout.expected
817 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
819 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
820 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
821 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
825 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
826 f259c4c1 2021-09-24 stsp echo "commit $merge_commit (master)" > $testroot/stdout.expected
827 f259c4c1 2021-09-24 stsp echo "commit $master_commit" >> $testroot/stdout.expected
828 f259c4c1 2021-09-24 stsp echo "commit $commit0" >> $testroot/stdout.expected
829 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
831 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
832 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
833 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
837 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > $testroot/stdout)
839 f259c4c1 2021-09-24 stsp echo 'Already up-to-date' > $testroot/stdout.expected
840 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
842 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
843 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
844 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
848 f259c4c1 2021-09-24 stsp # We should have created a merge commit with two parents.
849 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got log -l1 | grep ^parent > $testroot/stdout)
850 f259c4c1 2021-09-24 stsp echo "parent 1: $master_commit" > $testroot/stdout.expected
851 f259c4c1 2021-09-24 stsp echo "parent 2: $branch_commit3" >> $testroot/stdout.expected
852 6b5246e4 2023-06-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
854 6b5246e4 2023-06-05 stsp if [ $ret -ne 0 ]; then
855 6b5246e4 2023-06-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
857 6b5246e4 2023-06-05 stsp test_done "$testroot" "$ret"
860 6b5246e4 2023-06-05 stsp test_merge_continue_new_commit() {
861 6b5246e4 2023-06-05 stsp # "got merge -c" should refuse to run if the current branch tip has
862 6b5246e4 2023-06-05 stsp # changed since the merge was started, to avoid clobbering the changes.
863 6b5246e4 2023-06-05 stsp local testroot=`test_init merge_continue_new_commit`
865 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
866 6b5246e4 2023-06-05 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
867 6b5246e4 2023-06-05 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
869 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
870 6b5246e4 2023-06-05 stsp echo "modified alpha on master" > $testroot/repo/alpha
871 6b5246e4 2023-06-05 stsp git_commit $testroot/repo -m "committing to alpha on master"
873 6b5246e4 2023-06-05 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
875 6b5246e4 2023-06-05 stsp if [ $ret -ne 0 ]; then
876 6b5246e4 2023-06-05 stsp echo "got checkout failed unexpectedly" >&2
877 6b5246e4 2023-06-05 stsp test_done "$testroot" "$ret"
881 6b5246e4 2023-06-05 stsp (cd $testroot/wt && got merge -n newbranch >/dev/null)
883 6b5246e4 2023-06-05 stsp if [ $ret -ne 0 ]; then
884 6b5246e4 2023-06-05 stsp echo "got merge failed unexpectedly" >&2
885 6b5246e4 2023-06-05 stsp test_done "$testroot" "$ret"
889 6b5246e4 2023-06-05 stsp echo "modified alpha again on master" > $testroot/repo/alpha
890 6b5246e4 2023-06-05 stsp git_commit $testroot/repo -m "committing to alpha on master again"
892 6b5246e4 2023-06-05 stsp (cd $testroot/wt && got merge -c > $testroot/stdout 2> $testroot/stderr)
894 6b5246e4 2023-06-05 stsp if [ $ret -eq 0 ]; then
895 6b5246e4 2023-06-05 stsp echo "got merge succeeded unexpectedly" >&2
896 6b5246e4 2023-06-05 stsp test_done "$testroot" "1"
900 6b5246e4 2023-06-05 stsp echo -n > $testroot/stdout.expected
901 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
903 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
904 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
905 6b5246e4 2023-06-05 stsp test_done "$testroot" "$ret"
909 6b5246e4 2023-06-05 stsp echo -n "got: merging cannot proceed because the work tree is no " \
910 6b5246e4 2023-06-05 stsp > $testroot/stderr.expected
911 6b5246e4 2023-06-05 stsp echo "longer up-to-date; merge must be aborted and retried" \
912 6b5246e4 2023-06-05 stsp >> $testroot/stderr.expected
913 6b5246e4 2023-06-05 stsp cmp -s $testroot/stderr.expected $testroot/stderr
915 6b5246e4 2023-06-05 stsp if [ $ret -ne 0 ]; then
916 6b5246e4 2023-06-05 stsp diff -u $testroot/stderr.expected $testroot/stderr
918 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
921 f259c4c1 2021-09-24 stsp test_merge_abort() {
922 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_abort`
923 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
924 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
926 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
927 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
928 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
929 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
931 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
932 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
933 f259c4c1 2021-09-24 stsp local branch_commit1=`git_show_branch_head $testroot/repo newbranch`
934 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
935 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "removing beta on newbranch"
936 f259c4c1 2021-09-24 stsp local branch_commit2=`git_show_branch_head $testroot/repo newbranch`
937 f259c4c1 2021-09-24 stsp echo "new file on branch" > $testroot/repo/epsilon/new
938 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon/new
939 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "adding new file on newbranch"
940 f259c4c1 2021-09-24 stsp local branch_commit3=`git_show_branch_head $testroot/repo newbranch`
941 f73bf5bd 2023-10-01 naddy (cd $testroot/repo && ln -s alpha symlink)
942 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add symlink
943 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "adding symlink on newbranch"
944 f259c4c1 2021-09-24 stsp local branch_commit4=`git_show_branch_head $testroot/repo newbranch`
946 f259c4c1 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
948 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
949 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
950 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
954 41f061b2 2021-10-05 stsp # unrelated unversioned file in work tree
955 41f061b2 2021-10-05 stsp touch $testroot/wt/unversioned-file
957 f259c4c1 2021-09-24 stsp # create a conflicting commit
958 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
959 f259c4c1 2021-09-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
960 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on master"
961 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
963 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
964 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
966 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
967 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
968 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
972 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
973 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
975 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
976 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
977 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
981 f259c4c1 2021-09-24 stsp echo "C alpha" >> $testroot/stdout.expected
982 f259c4c1 2021-09-24 stsp echo "D beta" >> $testroot/stdout.expected
983 f259c4c1 2021-09-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
984 f259c4c1 2021-09-24 stsp echo "G gamma/delta" >> $testroot/stdout.expected
985 f259c4c1 2021-09-24 stsp echo "A symlink" >> $testroot/stdout.expected
986 f259c4c1 2021-09-24 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
987 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
989 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
990 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
991 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
995 f259c4c1 2021-09-24 stsp echo "got: conflicts must be resolved before merging can continue" \
996 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
997 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
999 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1000 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1001 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1005 af179be7 2023-04-14 stsp # unrelated added file added during conflict resolution
1006 af179be7 2023-04-14 stsp touch $testroot/wt/added-file
1007 af179be7 2023-04-14 stsp (cd $testroot/wt && got add added-file > /dev/null)
1009 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1011 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
1012 f4ab0e57 2024-03-28 stsp A added-file
1015 f4ab0e57 2024-03-28 stsp A epsilon/new
1016 f4ab0e57 2024-03-28 stsp M gamma/delta
1018 f4ab0e57 2024-03-28 stsp ? unversioned-file
1019 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
1021 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1023 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1024 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1025 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1029 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge -a > $testroot/stdout)
1031 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1032 f259c4c1 2021-09-24 stsp echo "got merge failed unexpectedly" >&2
1033 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1037 af179be7 2023-04-14 stsp echo "R added-file" > $testroot/stdout.expected
1038 af179be7 2023-04-14 stsp echo "R alpha" >> $testroot/stdout.expected
1039 f259c4c1 2021-09-24 stsp echo "R beta" >> $testroot/stdout.expected
1040 f259c4c1 2021-09-24 stsp echo "R epsilon/new" >> $testroot/stdout.expected
1041 f259c4c1 2021-09-24 stsp echo "R gamma/delta" >> $testroot/stdout.expected
1042 f259c4c1 2021-09-24 stsp echo "R symlink" >> $testroot/stdout.expected
1043 af179be7 2023-04-14 stsp echo "G added-file" >> $testroot/stdout.expected
1044 f259c4c1 2021-09-24 stsp echo "Merge of refs/heads/newbranch aborted" \
1045 f259c4c1 2021-09-24 stsp >> $testroot/stdout.expected
1047 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1049 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1050 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1051 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1055 f259c4c1 2021-09-24 stsp echo "delta" > $testroot/content.expected
1056 f259c4c1 2021-09-24 stsp cat $testroot/wt/gamma/delta > $testroot/content
1057 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
1059 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1060 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
1061 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1065 f259c4c1 2021-09-24 stsp echo "modified alpha on master" > $testroot/content.expected
1066 f259c4c1 2021-09-24 stsp cat $testroot/wt/alpha > $testroot/content
1067 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
1069 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1070 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
1071 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1075 f259c4c1 2021-09-24 stsp echo "beta" > $testroot/content.expected
1076 f259c4c1 2021-09-24 stsp cat $testroot/wt/beta > $testroot/content
1077 f259c4c1 2021-09-24 stsp cmp -s $testroot/content.expected $testroot/content
1079 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1080 f259c4c1 2021-09-24 stsp diff -u $testroot/content.expected $testroot/content
1081 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1085 f259c4c1 2021-09-24 stsp if [ -e $testroot/wt/epsilon/new ]; then
1086 f259c4c1 2021-09-24 stsp echo "reverted file epsilon/new still exists on disk" >&2
1087 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
1091 f259c4c1 2021-09-24 stsp if [ -e $testroot/wt/symlink ]; then
1092 f259c4c1 2021-09-24 stsp echo "reverted symlink still exists on disk" >&2
1093 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
1097 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1099 af179be7 2023-04-14 stsp echo "? added-file" > $testroot/stdout.expected
1100 af179be7 2023-04-14 stsp echo "? unversioned-file" >> $testroot/stdout.expected
1101 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1103 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1104 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1105 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1109 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1110 f259c4c1 2021-09-24 stsp echo "commit $master_commit (master)" > $testroot/stdout.expected
1111 f259c4c1 2021-09-24 stsp echo "commit $commit0" >> $testroot/stdout.expected
1112 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1114 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1115 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1116 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1120 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > $testroot/stdout)
1122 f259c4c1 2021-09-24 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1123 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1125 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1126 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1128 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1131 f259c4c1 2021-09-24 stsp test_merge_in_progress() {
1132 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_in_progress`
1133 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
1134 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1136 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1137 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1138 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
1139 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
1141 f259c4c1 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
1143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1144 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
1145 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1149 f259c4c1 2021-09-24 stsp # create a conflicting commit
1150 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1151 f259c4c1 2021-09-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
1152 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on master"
1153 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
1155 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
1156 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
1158 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1159 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
1160 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1164 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
1165 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
1167 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1168 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
1169 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
1173 f259c4c1 2021-09-24 stsp echo "C alpha" >> $testroot/stdout.expected
1174 f259c4c1 2021-09-24 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1175 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1177 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1178 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1179 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1183 f259c4c1 2021-09-24 stsp echo "got: conflicts must be resolved before merging can continue" \
1184 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
1185 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1187 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1188 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1189 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1193 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1195 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
1197 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
1199 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1201 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1202 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1203 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1207 f259c4c1 2021-09-24 stsp for cmd in update commit histedit "rebase newbranch" \
1208 42761529 2023-06-01 stsp "integrate newbranch" "merge newbranch" "stage alpha"; do
1209 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got $cmd > $testroot/stdout \
1210 f259c4c1 2021-09-24 stsp 2> $testroot/stderr)
1212 42761529 2023-06-01 stsp if [ $ret -eq 0 ]; then
1213 42761529 2023-06-01 stsp echo "got $cmd succeeded unexpectedly" >&2
1214 42761529 2023-06-01 stsp test_done "$testroot" "1"
1218 f259c4c1 2021-09-24 stsp echo -n > $testroot/stdout.expected
1219 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1221 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1222 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1223 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1227 f259c4c1 2021-09-24 stsp echo -n "got: a merge operation is in progress in this " \
1228 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
1229 f259c4c1 2021-09-24 stsp echo "work tree and must be continued or aborted first" \
1230 f259c4c1 2021-09-24 stsp >> $testroot/stderr.expected
1231 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1233 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1234 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1235 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1240 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1243 f259c4c1 2021-09-24 stsp test_merge_path_prefix() {
1244 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_path_prefix`
1245 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
1246 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1248 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1249 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1250 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
1251 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
1253 f259c4c1 2021-09-24 stsp got checkout -p epsilon -b master $testroot/repo $testroot/wt \
1254 f259c4c1 2021-09-24 stsp > /dev/null
1256 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1257 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
1258 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1262 f259c4c1 2021-09-24 stsp # create a conflicting commit
1263 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1264 f259c4c1 2021-09-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
1265 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on master"
1266 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
1268 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
1269 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
1271 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1272 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
1273 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1277 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
1278 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
1280 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1281 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
1282 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
1286 f259c4c1 2021-09-24 stsp echo -n "got: cannot merge branch which contains changes outside " \
1287 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
1288 f259c4c1 2021-09-24 stsp echo "of this work tree's path prefix" >> $testroot/stderr.expected
1289 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1291 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1292 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1294 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1297 f259c4c1 2021-09-24 stsp test_merge_missing_file() {
1298 f259c4c1 2021-09-24 stsp local testroot=`test_init merge_missing_file`
1299 f259c4c1 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
1300 f259c4c1 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1302 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1303 f259c4c1 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1304 f259c4c1 2021-09-24 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1305 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha and delta"
1306 f259c4c1 2021-09-24 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
1308 f259c4c1 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
1310 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1311 f259c4c1 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
1312 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1316 f259c4c1 2021-09-24 stsp # create a conflicting commit which renames alpha
1317 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1318 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv alpha epsilon/alpha-moved
1319 f259c4c1 2021-09-24 stsp git_commit $testroot/repo -m "moving alpha on master"
1320 f259c4c1 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
1322 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
1323 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
1325 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1326 f259c4c1 2021-09-24 stsp echo "got update failed unexpectedly" >&2
1327 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1331 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
1332 f259c4c1 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
1334 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1335 f259c4c1 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
1336 f259c4c1 2021-09-24 stsp test_done "$testroot" "1"
1340 f259c4c1 2021-09-24 stsp echo "! alpha" > $testroot/stdout.expected
1341 f259c4c1 2021-09-24 stsp echo "G gamma/delta" >> $testroot/stdout.expected
1342 35ca1db7 2021-09-28 stsp echo -n "Files which had incoming changes but could not be found " \
1343 35ca1db7 2021-09-28 stsp >> $testroot/stdout.expected
1344 35ca1db7 2021-09-28 stsp echo "in the work tree: 1" >> $testroot/stdout.expected
1345 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1347 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1348 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1349 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1353 c1b05723 2021-09-28 stsp echo -n "got: changes destined for some files " \
1354 f259c4c1 2021-09-24 stsp > $testroot/stderr.expected
1355 f259c4c1 2021-09-24 stsp echo -n "were not yet merged and should be merged manually if " \
1356 f259c4c1 2021-09-24 stsp >> $testroot/stderr.expected
1357 f259c4c1 2021-09-24 stsp echo "required before the merge operation is continued" \
1358 f259c4c1 2021-09-24 stsp >> $testroot/stderr.expected
1359 f259c4c1 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1361 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1362 f259c4c1 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1363 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1367 f259c4c1 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1369 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
1370 f4ab0e57 2024-03-28 stsp M gamma/delta
1371 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
1373 a6a8f8bb 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1375 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1376 a6a8f8bb 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1377 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1381 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1384 a6a8f8bb 2021-09-24 stsp test_merge_no_op() {
1385 a6a8f8bb 2021-09-24 stsp local testroot=`test_init merge_no_op`
1386 a6a8f8bb 2021-09-24 stsp local commit0=`git_show_head $testroot/repo`
1387 a6a8f8bb 2021-09-24 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1389 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1390 a6a8f8bb 2021-09-24 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1391 a6a8f8bb 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
1392 35d2583f 2023-04-17 stsp local branch_commit=`git_show_branch_head $testroot/repo newbranch`
1394 a6a8f8bb 2021-09-24 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
1396 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1397 a6a8f8bb 2021-09-24 stsp echo "got checkout failed unexpectedly" >&2
1398 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1402 a6a8f8bb 2021-09-24 stsp # create a conflicting commit
1403 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1404 a6a8f8bb 2021-09-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
1405 a6a8f8bb 2021-09-24 stsp git_commit $testroot/repo -m "committing to alpha on master"
1406 a6a8f8bb 2021-09-24 stsp local master_commit=`git_show_head $testroot/repo`
1408 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
1409 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got update > /dev/null)
1411 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1412 a6a8f8bb 2021-09-24 stsp echo "got update failed unexpectedly" >&2
1413 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1417 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got merge newbranch \
1418 a6a8f8bb 2021-09-24 stsp > $testroot/stdout 2> $testroot/stderr)
1420 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1421 a6a8f8bb 2021-09-24 stsp echo "got merge succeeded unexpectedly" >&2
1422 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "1"
1426 a6a8f8bb 2021-09-24 stsp echo "C alpha" >> $testroot/stdout.expected
1427 a6a8f8bb 2021-09-24 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1428 a6a8f8bb 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1430 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1431 a6a8f8bb 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1432 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1436 a6a8f8bb 2021-09-24 stsp echo "got: conflicts must be resolved before merging can continue" \
1437 a6a8f8bb 2021-09-24 stsp > $testroot/stderr.expected
1438 a6a8f8bb 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1440 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1441 a6a8f8bb 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1442 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1446 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1448 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
1450 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
1452 f259c4c1 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1454 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1455 f259c4c1 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1456 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1460 a6a8f8bb 2021-09-24 stsp # resolve the conflict by reverting all changes; now it is no-op merge
1461 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got revert alpha > /dev/null)
1463 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1464 a6a8f8bb 2021-09-24 stsp echo "got revert failed unexpectedly" >&2
1465 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1469 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got merge -c > $testroot/stdout \
1470 a6a8f8bb 2021-09-24 stsp 2> $testroot/stderr)
1472 35d2583f 2023-04-17 stsp if [ $ret -ne 0 ]; then
1473 35d2583f 2023-04-17 stsp echo "got merge failed unexpectedly" >&2
1474 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1478 35d2583f 2023-04-17 stsp echo -n '' > $testroot/stderr.expected
1479 a6a8f8bb 2021-09-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1481 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1482 a6a8f8bb 2021-09-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1483 35d2583f 2023-04-17 stsp test_done "$testroot" "$ret"
1487 35d2583f 2023-04-17 stsp local merge_commit=`git_show_head $testroot/repo`
1488 35d2583f 2023-04-17 stsp echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
1489 35d2583f 2023-04-17 stsp > $testroot/stdout.expected
1490 35d2583f 2023-04-17 stsp echo $merge_commit >> $testroot/stdout.expected
1492 35d2583f 2023-04-17 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1494 35d2583f 2023-04-17 stsp if [ $ret -ne 0 ]; then
1495 35d2583f 2023-04-17 stsp diff -u $testroot/stdout.expected $testroot/stdout
1496 a6a8f8bb 2021-09-24 stsp test_done "$testroot" "$ret"
1500 a6a8f8bb 2021-09-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
1502 a6a8f8bb 2021-09-24 stsp echo -n "" > $testroot/stdout.expected
1503 4e91ef15 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1505 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1506 4e91ef15 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1507 35d2583f 2023-04-17 stsp test_done "$testroot" "$ret"
1511 35d2583f 2023-04-17 stsp # We should have created a merge commit with two parents.
1512 35d2583f 2023-04-17 stsp got log -r $testroot/repo -l1 -c $merge_commit | grep ^parent \
1513 35d2583f 2023-04-17 stsp > $testroot/stdout
1514 35d2583f 2023-04-17 stsp echo "parent 1: $master_commit" > $testroot/stdout.expected
1515 35d2583f 2023-04-17 stsp echo "parent 2: $branch_commit" >> $testroot/stdout.expected
1516 35d2583f 2023-04-17 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1518 35d2583f 2023-04-17 stsp if [ $ret -ne 0 ]; then
1519 35d2583f 2023-04-17 stsp diff -u $testroot/stdout.expected $testroot/stdout
1521 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1524 4e91ef15 2021-09-26 stsp test_merge_imported_branch() {
1525 4e91ef15 2021-09-26 stsp local testroot=`test_init merge_import`
1526 4e91ef15 2021-09-26 stsp local commit0=`git_show_head $testroot/repo`
1527 4e91ef15 2021-09-26 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1529 4e91ef15 2021-09-26 stsp # import a new sub-tree to the 'files' branch such that
1530 4e91ef15 2021-09-26 stsp # none of the files added here collide with existing ones
1531 4e91ef15 2021-09-26 stsp mkdir -p $testroot/tree/there
1532 4e91ef15 2021-09-26 stsp mkdir -p $testroot/tree/be/lots
1533 4e91ef15 2021-09-26 stsp mkdir -p $testroot/tree/files
1534 4e91ef15 2021-09-26 stsp echo "there should" > $testroot/tree/there/should
1535 4e91ef15 2021-09-26 stsp echo "be lots of" > $testroot/tree/be/lots/of
1536 4e91ef15 2021-09-26 stsp echo "files here" > $testroot/tree/files/here
1537 4e91ef15 2021-09-26 stsp got import -r $testroot/repo -b files -m 'import files' \
1538 4e91ef15 2021-09-26 stsp $testroot/tree > /dev/null
1540 4e91ef15 2021-09-26 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
1542 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1543 4e91ef15 2021-09-26 stsp echo "got checkout failed unexpectedly" >&2
1544 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1548 4e91ef15 2021-09-26 stsp (cd $testroot/wt && got merge files > $testroot/stdout)
1550 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1551 4e91ef15 2021-09-26 stsp echo "got merge failed unexpectedly" >&2
1552 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1556 4e91ef15 2021-09-26 stsp local merge_commit0=`git_show_head $testroot/repo`
1557 4e91ef15 2021-09-26 stsp cat > $testroot/stdout.expected <<EOF
1558 4e91ef15 2021-09-26 stsp A be/lots/of
1559 4e91ef15 2021-09-26 stsp A files/here
1560 4e91ef15 2021-09-26 stsp A there/should
1561 4e91ef15 2021-09-26 stsp Merged refs/heads/files into refs/heads/master: $merge_commit0
1563 4e91ef15 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1565 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1566 4e91ef15 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1567 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1571 4e91ef15 2021-09-26 stsp # try to merge again while no new changes are available
1572 4e91ef15 2021-09-26 stsp (cd $testroot/wt && got merge files > $testroot/stdout)
1574 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1575 4e91ef15 2021-09-26 stsp echo "got merge failed unexpectedly" >&2
1576 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1579 4e91ef15 2021-09-26 stsp echo "Already up-to-date" > $testroot/stdout.expected
1580 a6a8f8bb 2021-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1582 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1583 a6a8f8bb 2021-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1584 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1588 4e91ef15 2021-09-26 stsp # update the 'files' branch
1589 f73bf5bd 2023-10-01 naddy git -C $testroot/repo reset -q --hard master
1590 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q files
1591 4e91ef15 2021-09-26 stsp echo "indeed" > $testroot/repo/indeed
1592 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add indeed
1593 4e91ef15 2021-09-26 stsp git_commit $testroot/repo -m "adding another file indeed"
1594 4e91ef15 2021-09-26 stsp echo "be lots and lots of" > $testroot/repo/be/lots/of
1595 4e91ef15 2021-09-26 stsp git_commit $testroot/repo -m "lots of changes"
1597 4e91ef15 2021-09-26 stsp (cd $testroot/wt && got update > /dev/null)
1599 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1600 4e91ef15 2021-09-26 stsp echo "got update failed unexpectedly" >&2
1601 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1605 4e91ef15 2021-09-26 stsp # we should now be able to merge more changes from files branch
1606 4e91ef15 2021-09-26 stsp (cd $testroot/wt && got merge files > $testroot/stdout)
1608 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1609 4e91ef15 2021-09-26 stsp echo "got merge failed unexpectedly" >&2
1610 4e91ef15 2021-09-26 stsp test_done "$testroot" "$ret"
1614 4e91ef15 2021-09-26 stsp local merge_commit1=`git_show_branch_head $testroot/repo master`
1615 4e91ef15 2021-09-26 stsp cat > $testroot/stdout.expected <<EOF
1616 4e91ef15 2021-09-26 stsp G be/lots/of
1618 4e91ef15 2021-09-26 stsp Merged refs/heads/files into refs/heads/master: $merge_commit1
1621 4e91ef15 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1623 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1624 4e91ef15 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1626 f259c4c1 2021-09-24 stsp test_done "$testroot" "$ret"
1629 088449d3 2021-09-26 stsp test_merge_interrupt() {
1630 088449d3 2021-09-26 stsp local testroot=`test_init merge_interrupt`
1631 088449d3 2021-09-26 stsp local commit0=`git_show_head $testroot/repo`
1632 088449d3 2021-09-26 stsp local commit0_author_time=`git_show_author_time $testroot/repo`
1634 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1635 088449d3 2021-09-26 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1636 088449d3 2021-09-26 stsp git_commit $testroot/repo -m "committing to alpha on newbranch"
1637 088449d3 2021-09-26 stsp local branch_commit0=`git_show_branch_head $testroot/repo newbranch`
1639 088449d3 2021-09-26 stsp got checkout -b master $testroot/repo $testroot/wt > /dev/null
1641 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1642 088449d3 2021-09-26 stsp echo "got checkout failed unexpectedly" >&2
1643 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1647 088449d3 2021-09-26 stsp # create a non-conflicting commit
1648 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1649 088449d3 2021-09-26 stsp echo "modified beta on master" > $testroot/repo/beta
1650 088449d3 2021-09-26 stsp git_commit $testroot/repo -m "committing to beta on master"
1651 088449d3 2021-09-26 stsp local master_commit=`git_show_head $testroot/repo`
1653 5e91dae4 2022-08-30 stsp # need an up-to-date work tree for 'got merge'
1654 088449d3 2021-09-26 stsp (cd $testroot/wt && got update > /dev/null)
1656 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1657 088449d3 2021-09-26 stsp echo "got update failed unexpectedly" >&2
1658 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1662 088449d3 2021-09-26 stsp (cd $testroot/wt && got merge -n newbranch \
1663 088449d3 2021-09-26 stsp > $testroot/stdout 2> $testroot/stderr)
1665 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1666 088449d3 2021-09-26 stsp echo "got merge failed unexpectedly" >&2
1667 088449d3 2021-09-26 stsp test_done "$testroot" "1"
1671 088449d3 2021-09-26 stsp echo "G alpha" > $testroot/stdout.expected
1672 088449d3 2021-09-26 stsp echo "Merge of refs/heads/newbranch interrupted on request" \
1673 088449d3 2021-09-26 stsp >> $testroot/stdout.expected
1674 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1676 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1677 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1678 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1682 088449d3 2021-09-26 stsp (cd $testroot/wt && got status > $testroot/stdout)
1684 f4ab0e57 2024-03-28 stsp cat > $testroot/stdout.expected <<EOF
1686 f4ab0e57 2024-03-28 stsp Work tree is merging refs/heads/newbranch into refs/heads/master
1688 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1690 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1691 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1692 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1696 088449d3 2021-09-26 stsp echo "modified alpha on branch" > $testroot/content.expected
1697 088449d3 2021-09-26 stsp cat $testroot/wt/alpha > $testroot/content
1698 088449d3 2021-09-26 stsp cmp -s $testroot/content.expected $testroot/content
1700 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1701 088449d3 2021-09-26 stsp diff -u $testroot/content.expected $testroot/content
1702 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1706 088449d3 2021-09-26 stsp # adjust merge result
1707 088449d3 2021-09-26 stsp echo "adjusted merge result" > $testroot/wt/alpha
1709 088449d3 2021-09-26 stsp # continue the merge
1710 088449d3 2021-09-26 stsp (cd $testroot/wt && got merge -c > $testroot/stdout)
1712 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1713 088449d3 2021-09-26 stsp echo "got merge failed unexpectedly" >&2
1714 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1718 088449d3 2021-09-26 stsp local merge_commit=`git_show_head $testroot/repo`
1720 0ff8d236 2021-09-28 stsp echo "M alpha" > $testroot/stdout.expected
1721 088449d3 2021-09-26 stsp echo -n "Merged refs/heads/newbranch into refs/heads/master: " \
1722 0ff8d236 2021-09-28 stsp >> $testroot/stdout.expected
1723 088449d3 2021-09-26 stsp echo $merge_commit >> $testroot/stdout.expected
1725 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1727 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1728 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1729 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1733 088449d3 2021-09-26 stsp (cd $testroot/wt && got status > $testroot/stdout)
1735 088449d3 2021-09-26 stsp echo -n > $testroot/stdout.expected
1736 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1738 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1739 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1740 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1744 088449d3 2021-09-26 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1745 088449d3 2021-09-26 stsp echo "commit $merge_commit (master)" > $testroot/stdout.expected
1746 088449d3 2021-09-26 stsp echo "commit $master_commit" >> $testroot/stdout.expected
1747 088449d3 2021-09-26 stsp echo "commit $commit0" >> $testroot/stdout.expected
1748 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1750 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1751 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1752 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1756 088449d3 2021-09-26 stsp (cd $testroot/wt && got update > $testroot/stdout)
1758 088449d3 2021-09-26 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1759 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1761 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1762 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1763 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1767 088449d3 2021-09-26 stsp # We should have created a merge commit with two parents.
1768 088449d3 2021-09-26 stsp (cd $testroot/wt && got log -l1 | grep ^parent > $testroot/stdout)
1769 088449d3 2021-09-26 stsp echo "parent 1: $master_commit" > $testroot/stdout.expected
1770 088449d3 2021-09-26 stsp echo "parent 2: $branch_commit0" >> $testroot/stdout.expected
1771 088449d3 2021-09-26 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1773 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1774 088449d3 2021-09-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1776 088449d3 2021-09-26 stsp test_done "$testroot" "$ret"
1779 b2b3fce1 2022-10-29 op test_merge_umask() {
1780 b2b3fce1 2022-10-29 op local testroot=`test_init merge_umask`
1782 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1783 b2b3fce1 2022-10-29 op echo "modified alpha on branch" >$testroot/repo/alpha
1784 b2b3fce1 2022-10-29 op git_commit "$testroot/repo" -m "committing alpha on newbranch"
1785 b2b3fce1 2022-10-29 op echo "modified delta on branch" >$testroot/repo/gamma/delta
1786 b2b3fce1 2022-10-29 op git_commit "$testroot/repo" -m "committing delta on newbranch"
1788 b2b3fce1 2022-10-29 op # diverge from newbranch
1789 f73bf5bd 2023-10-01 naddy git -C "$testroot/repo" checkout -q master
1790 b2b3fce1 2022-10-29 op echo "modified beta on master" >$testroot/repo/beta
1791 b2b3fce1 2022-10-29 op git_commit "$testroot/repo" -m "committing zeto no master"
1793 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
1795 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
1796 b2b3fce1 2022-10-29 op (umask 077 && cd "$testroot/wt" && got merge newbranch) >/dev/null
1798 b2b3fce1 2022-10-29 op for f in alpha gamma/delta; do
1799 b2b3fce1 2022-10-29 op ls -l "$testroot/wt/$f" | grep -q ^-rw-------
1800 b2b3fce1 2022-10-29 op if [ $? -ne 0 ]; then
1801 b2b3fce1 2022-10-29 op echo "$f is not 0600 after merge" >&2
1802 b2b3fce1 2022-10-29 op ls -l "$testroot/wt/$f" >&2
1803 b2b3fce1 2022-10-29 op test_done "$testroot" 1
1807 b2b3fce1 2022-10-29 op test_done "$testroot" 0
1810 d51d11be 2023-02-21 op test_merge_gitconfig_author() {
1811 d51d11be 2023-02-21 op local testroot=`test_init merge_gitconfig_author`
1813 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config user.name 'Flan Luck'
1814 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config user.email 'flan_luck@openbsd.org'
1816 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1817 d51d11be 2023-02-21 op echo "modified alpha on branch" >$testroot/repo/alpha
1818 d51d11be 2023-02-21 op git_commit "$testroot/repo" -m "committing alpha on newbranch"
1819 d51d11be 2023-02-21 op echo "modified delta on branch" >$testroot/repo/gamma/delta
1820 d51d11be 2023-02-21 op git_commit "$testroot/repo" -m "committing delta on newbranch"
1822 d51d11be 2023-02-21 op # diverge from newbranch
1823 f73bf5bd 2023-10-01 naddy git -C "$testroot/repo" checkout -q master
1824 d51d11be 2023-02-21 op echo "modified beta on master" >$testroot/repo/beta
1825 d51d11be 2023-02-21 op git_commit "$testroot/repo" -m "committing zeto no master"
1827 d51d11be 2023-02-21 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
1829 d51d11be 2023-02-21 op # unset in a subshell to avoid affecting our environment
1830 d51d11be 2023-02-21 op (unset GOT_IGNORE_GITCONFIG && cd $testroot/wt && \
1831 d51d11be 2023-02-21 op got merge newbranch > /dev/null)
1833 d51d11be 2023-02-21 op (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
1835 d51d11be 2023-02-21 op if [ $ret -ne 0 ]; then
1836 d51d11be 2023-02-21 op test_done "$testroot" "$ret"
1840 d51d11be 2023-02-21 op echo "from: Flan Luck <flan_luck@openbsd.org>" \
1841 d51d11be 2023-02-21 op > $testroot/stdout.expected
1842 d51d11be 2023-02-21 op cmp -s $testroot/stdout.expected $testroot/stdout
1844 d51d11be 2023-02-21 op if [ $ret -ne 0 ]; then
1845 d51d11be 2023-02-21 op diff -u $testroot/stdout.expected $testroot/stdout
1847 d51d11be 2023-02-21 op test_done "$testroot" "$ret"
1850 13342307 2023-06-21 stsp test_merge_fetched_branch() {
1851 13342307 2023-06-21 stsp local testroot=`test_init merge_fetched_branch`
1852 13342307 2023-06-21 stsp local testurl=ssh://127.0.0.1/$testroot
1853 13342307 2023-06-21 stsp local commit_id=`git_show_head $testroot/repo`
1855 13342307 2023-06-21 stsp got clone -q $testurl/repo $testroot/repo-clone
1857 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1858 13342307 2023-06-21 stsp echo "got clone command failed unexpectedly" >&2
1859 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1863 13342307 2023-06-21 stsp echo "modified alpha" > $testroot/repo/alpha
1864 13342307 2023-06-21 stsp git_commit $testroot/repo -m "modified alpha"
1865 13342307 2023-06-21 stsp local commit_id2=`git_show_head $testroot/repo`
1867 13342307 2023-06-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout
1869 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1870 13342307 2023-06-21 stsp echo "got fetch command failed unexpectedly" >&2
1871 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1875 13342307 2023-06-21 stsp echo -n > $testroot/stdout.expected
1877 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1879 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1880 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1881 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1885 13342307 2023-06-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1887 13342307 2023-06-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1888 13342307 2023-06-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1889 13342307 2023-06-21 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1890 13342307 2023-06-21 stsp >> $testroot/stdout.expected
1891 13342307 2023-06-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
1892 13342307 2023-06-21 stsp >> $testroot/stdout.expected
1894 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1896 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1897 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1898 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1902 13342307 2023-06-21 stsp got checkout $testroot/repo-clone $testroot/wt > /dev/null
1904 13342307 2023-06-21 stsp echo "modified beta" > $testroot/wt/beta
1905 13342307 2023-06-21 stsp (cd $testroot/wt && got commit -m "modified beta" > /dev/null)
1906 13342307 2023-06-21 stsp local commit_id3=`git_show_head $testroot/repo-clone`
1908 13342307 2023-06-21 stsp (cd $testroot/wt && got update > /dev/null)
1909 13342307 2023-06-21 stsp (cd $testroot/wt && got merge origin/master > $testroot/stdout)
1910 13342307 2023-06-21 stsp local merge_commit_id=`git_show_head $testroot/repo-clone`
1912 13342307 2023-06-21 stsp cat > $testroot/stdout.expected <<EOF
1914 13342307 2023-06-21 stsp Merged refs/remotes/origin/master into refs/heads/master: $merge_commit_id
1917 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1919 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1920 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1922 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1925 13342307 2023-06-21 stsp test_merge_fetched_branch_remote() {
1926 13342307 2023-06-21 stsp local testroot=`test_init merge_fetched_branch_remote`
1927 13342307 2023-06-21 stsp local testurl=ssh://127.0.0.1/$testroot
1928 13342307 2023-06-21 stsp local commit_id=`git_show_head $testroot/repo`
1930 13342307 2023-06-21 stsp got clone -q $testurl/repo $testroot/repo-clone
1932 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1933 13342307 2023-06-21 stsp echo "got clone command failed unexpectedly" >&2
1934 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1938 13342307 2023-06-21 stsp echo "modified alpha" > $testroot/repo/alpha
1939 13342307 2023-06-21 stsp git_commit $testroot/repo -m "modified alpha"
1940 13342307 2023-06-21 stsp local commit_id2=`git_show_head $testroot/repo`
1942 13342307 2023-06-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout
1944 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1945 13342307 2023-06-21 stsp echo "got fetch command failed unexpectedly" >&2
1946 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1950 13342307 2023-06-21 stsp echo -n > $testroot/stdout.expected
1952 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1954 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1955 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1956 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1960 13342307 2023-06-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1962 13342307 2023-06-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1963 13342307 2023-06-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1964 13342307 2023-06-21 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1965 13342307 2023-06-21 stsp >> $testroot/stdout.expected
1966 13342307 2023-06-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
1967 13342307 2023-06-21 stsp >> $testroot/stdout.expected
1969 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1971 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1972 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1973 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1977 13342307 2023-06-21 stsp got checkout $testroot/repo-clone $testroot/wt > /dev/null
1979 13342307 2023-06-21 stsp echo "modified beta" > $testroot/wt/beta
1980 13342307 2023-06-21 stsp (cd $testroot/wt && got commit -m "modified beta" > /dev/null)
1981 13342307 2023-06-21 stsp local commit_id3=`git_show_head $testroot/repo-clone`
1983 13342307 2023-06-21 stsp (cd $testroot/wt && got update -b origin/master > /dev/null)
1984 13342307 2023-06-21 stsp (cd $testroot/wt && got merge master > \
1985 13342307 2023-06-21 stsp $testroot/stdout 2> $testroot/stderr)
1986 13342307 2023-06-21 stsp local merge_commit_id=`git_show_head $testroot/repo-clone`
1988 13342307 2023-06-21 stsp echo -n > $testroot/stdout.expected
1990 13342307 2023-06-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1992 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
1993 13342307 2023-06-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1994 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
1998 13342307 2023-06-21 stsp echo -n "got: work tree's current branch refs/remotes/origin/master " \
1999 13342307 2023-06-21 stsp > $testroot/stderr.expected
2000 13342307 2023-06-21 stsp echo -n 'is outside the "refs/heads/" reference namespace; ' \
2001 13342307 2023-06-21 stsp >> $testroot/stderr.expected
2002 13342307 2023-06-21 stsp echo -n "update -b required: will not commit to a branch " \
2003 13342307 2023-06-21 stsp >> $testroot/stderr.expected
2004 13342307 2023-06-21 stsp echo 'outside the "refs/heads/" reference namespace' \
2005 13342307 2023-06-21 stsp >> $testroot/stderr.expected
2007 13342307 2023-06-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
2009 13342307 2023-06-21 stsp if [ $ret -ne 0 ]; then
2010 13342307 2023-06-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
2012 13342307 2023-06-21 stsp test_done "$testroot" "$ret"
2015 f259c4c1 2021-09-24 stsp test_parseargs "$@"
2016 f259c4c1 2021-09-24 stsp run_test test_merge_basic
2017 179f9db0 2023-06-20 falsifian run_test test_merge_forward
2018 481cdc74 2023-07-01 falsifian run_test test_merge_forward_commit
2019 481cdc74 2023-07-01 falsifian run_test test_merge_forward_interrupt
2020 179f9db0 2023-06-20 falsifian run_test test_merge_backward
2021 f259c4c1 2021-09-24 stsp run_test test_merge_continue
2022 6b5246e4 2023-06-05 stsp run_test test_merge_continue_new_commit
2023 f259c4c1 2021-09-24 stsp run_test test_merge_abort
2024 f259c4c1 2021-09-24 stsp run_test test_merge_in_progress
2025 f259c4c1 2021-09-24 stsp run_test test_merge_path_prefix
2026 f259c4c1 2021-09-24 stsp run_test test_merge_missing_file
2027 a6a8f8bb 2021-09-24 stsp run_test test_merge_no_op
2028 4e91ef15 2021-09-26 stsp run_test test_merge_imported_branch
2029 088449d3 2021-09-26 stsp run_test test_merge_interrupt
2030 b2b3fce1 2022-10-29 op run_test test_merge_umask
2031 d51d11be 2023-02-21 op run_test test_merge_gitconfig_author
2032 13342307 2023-06-21 stsp run_test test_merge_fetched_branch
2033 13342307 2023-06-21 stsp run_test test_merge_fetched_branch_remote