add ssh -J jumphost support to commands which use the network
[got-portable.git] / regress / cmdline / branch.sh
blob6b14508b86ae76b06c4b422f9dddcb726e665798
1 #!/bin/sh
3 # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 . ./common.sh
19 test_branch_create() {
20 local testroot=`test_init branch_create`
21 local commit_id0=`git_show_head $testroot/repo`
23 # Create a branch based on repository's HEAD reference
24 got branch -r $testroot/repo newbranch
25 ret=$?
26 if [ $ret -ne 0 ]; then
27 echo "got branch command failed unexpectedly"
28 test_done "$testroot" "$ret"
29 return 1
32 # Ensure that Git recognizes the branch Got has created
33 git -C $testroot/repo checkout -q newbranch
34 ret=$?
35 if [ $ret -ne 0 ]; then
36 echo "git checkout command failed unexpectedly"
37 test_done "$testroot" "$ret"
38 return 1
40 echo "modified delta on branch" > $testroot/repo/gamma/delta
41 git_commit $testroot/repo -m "committing to delta on newbranch"
43 got checkout -b newbranch $testroot/repo $testroot/wt >/dev/null
44 ret=$?
45 if [ $ret -ne 0 ]; then
46 echo "got checkout command failed unexpectedly"
47 test_done "$testroot" "$ret"
48 return 1
51 echo "modified delta on branch" > $testroot/content.expected
52 cat $testroot/wt/gamma/delta > $testroot/content
53 cmp -s $testroot/content.expected $testroot/content
54 ret=$?
55 if [ $ret -ne 0 ]; then
56 diff -u $testroot/content.expected $testroot/content
57 test_done "$testroot" "$ret"
58 return 1
61 # Create a branch based on the work tree's branch
62 (cd $testroot/wt && got branch -n refs/heads/anotherbranch)
63 ret=$?
64 if [ $ret -ne 0 ]; then
65 test_done "$testroot" "$ret"
66 return 1
69 git -C $testroot/repo checkout -q anotherbranch
70 ret=$?
71 if [ $ret -ne 0 ]; then
72 echo "git checkout command failed unexpectedly"
73 test_done "$testroot" "$ret"
74 return 1
77 # Create a branch based on another specific branch
78 (cd $testroot/wt && got branch -n -c master yetanotherbranch)
79 ret=$?
80 if [ $ret -ne 0 ]; then
81 test_done "$testroot" "$ret"
82 return 1
85 git -C $testroot/repo checkout -q yetanotherbranch
86 ret=$?
87 if [ $ret -ne 0 ]; then
88 echo "git checkout command failed unexpectedly"
89 test_done "$testroot" "$ret"
90 return 1
93 # Create a branch based on a specific commit
94 local commit_id=`git_show_head $testroot/repo`
95 got branch -r $testroot/repo -c $commit_id commitbranch
96 ret=$?
97 if [ $ret -ne 0 ]; then
98 echo "got branch command failed unexpectedly"
99 test_done "$testroot" "$ret"
100 return 1
103 git -C $testroot/repo checkout -q commitbranch
104 ret=$?
105 if [ $ret -ne 0 ]; then
106 echo "git checkout command failed unexpectedly"
107 test_done "$testroot" "$ret"
108 return 1
111 # Create a branch and let the work tree be updated to it
112 (cd $testroot/wt && got branch -c $commit_id0 updatebranch \
113 > $testroot/stdout)
115 echo -n "Switching work tree from refs/heads/newbranch to " \
116 > $testroot/stdout.expected
117 echo "refs/heads/updatebranch" >> $testroot/stdout.expected
118 echo "U gamma/delta" >> $testroot/stdout.expected
119 echo "Updated to refs/heads/updatebranch: $commit_id0" \
120 >> $testroot/stdout.expected
122 cmp -s $testroot/stdout.expected $testroot/stdout
123 ret=$?
124 if [ $ret -ne 0 ]; then
125 diff -u $testroot/stdout.expected $testroot/stdout
127 test_done "$testroot" "$ret"
130 test_branch_list() {
131 local testroot=`test_init branch_list`
132 local commit_id=`git_show_head $testroot/repo`
134 for b in branch1 branch2 branch3; do
135 got branch -r $testroot/repo $b
136 ret=$?
137 if [ $ret -ne 0 ]; then
138 echo "got branch command failed unexpectedly"
139 test_done "$testroot" "$ret"
140 return 1
142 done
144 got branch -l -r $testroot/repo > $testroot/stdout
145 echo " branch1: $commit_id" > $testroot/stdout.expected
146 echo " branch2: $commit_id" >> $testroot/stdout.expected
147 echo " branch3: $commit_id" >> $testroot/stdout.expected
148 echo " master: $commit_id" >> $testroot/stdout.expected
149 cmp -s $testroot/stdout $testroot/stdout.expected
150 ret=$?
151 if [ $ret -ne 0 ]; then
152 diff -u $testroot/stdout.expected $testroot/stdout
153 test_done "$testroot" "$ret"
154 return 1
157 got checkout $testroot/repo $testroot/wt >/dev/null
158 ret=$?
159 if [ $ret -ne 0 ]; then
160 echo "got checkout command failed unexpectedly"
161 test_done "$testroot" "$ret"
162 return 1
165 (cd $testroot/wt && got branch -l > $testroot/stdout)
166 echo " branch1: $commit_id" > $testroot/stdout.expected
167 echo " branch2: $commit_id" >> $testroot/stdout.expected
168 echo " branch3: $commit_id" >> $testroot/stdout.expected
169 echo "* master: $commit_id" >> $testroot/stdout.expected
170 cmp -s $testroot/stdout $testroot/stdout.expected
171 ret=$?
172 if [ $ret -ne 0 ]; then
173 diff -u $testroot/stdout.expected $testroot/stdout
174 test_done "$testroot" "$ret"
175 return 1
178 echo "modified delta" > $testroot/repo/gamma/delta
179 git_commit $testroot/repo -m "committing to delta"
180 local commit_id2=`git_show_head $testroot/repo`
182 (cd $testroot/wt && got branch -l > $testroot/stdout)
183 echo " branch1: $commit_id" > $testroot/stdout.expected
184 echo " branch2: $commit_id" >> $testroot/stdout.expected
185 echo " branch3: $commit_id" >> $testroot/stdout.expected
186 echo "~ master: $commit_id2" >> $testroot/stdout.expected
187 cmp -s $testroot/stdout $testroot/stdout.expected
188 ret=$?
189 if [ $ret -ne 0 ]; then
190 diff -u $testroot/stdout.expected $testroot/stdout
191 test_done "$testroot" "$ret"
192 return 1
195 (cd $testroot/wt && got update > /dev/null)
196 ret=$?
197 if [ $ret -ne 0 ]; then
198 echo "got update command failed unexpectedly"
199 test_done "$testroot" "$ret"
200 return 1
203 (cd $testroot/wt && got branch -l > $testroot/stdout)
204 echo " branch1: $commit_id" > $testroot/stdout.expected
205 echo " branch2: $commit_id" >> $testroot/stdout.expected
206 echo " branch3: $commit_id" >> $testroot/stdout.expected
207 echo "* master: $commit_id2" >> $testroot/stdout.expected
208 cmp -s $testroot/stdout $testroot/stdout.expected
209 ret=$?
210 if [ $ret -ne 0 ]; then
211 diff -u $testroot/stdout.expected $testroot/stdout
212 test_done "$testroot" "$ret"
213 return 1
216 (cd $testroot/wt && got update -b branch1 > /dev/null)
217 ret=$?
218 if [ $ret -ne 0 ]; then
219 echo "got update command failed unexpectedly"
220 test_done "$testroot" "$ret"
221 return 1
224 (cd $testroot/wt && got branch -l > $testroot/stdout)
225 echo "* branch1: $commit_id" > $testroot/stdout.expected
226 echo " branch2: $commit_id" >> $testroot/stdout.expected
227 echo " branch3: $commit_id" >> $testroot/stdout.expected
228 echo " master: $commit_id2" >> $testroot/stdout.expected
229 cmp -s $testroot/stdout $testroot/stdout.expected
230 ret=$?
231 if [ $ret -ne 0 ]; then
232 diff -u $testroot/stdout.expected $testroot/stdout
234 test_done "$testroot" "$ret"
237 test_branch_delete() {
238 local testroot=`test_init branch_delete`
239 local commit_id=`git_show_head $testroot/repo`
241 for b in branch1 branch2 branch3; do
242 got branch -r $testroot/repo $b
243 ret=$?
244 if [ $ret -ne 0 ]; then
245 echo "got branch command failed unexpectedly"
246 test_done "$testroot" "$ret"
247 return 1
249 done
251 got branch -d branch2 -r $testroot/repo > $testroot/stdout
252 ret=$?
253 if [ $ret -ne 0 ]; then
254 echo "got branch command failed unexpectedly"
255 test_done "$testroot" "$ret"
256 return 1
259 got branch -l -r $testroot/repo > $testroot/stdout
260 echo " branch1: $commit_id" > $testroot/stdout.expected
261 echo " branch3: $commit_id" >> $testroot/stdout.expected
262 echo " master: $commit_id" >> $testroot/stdout.expected
263 cmp -s $testroot/stdout $testroot/stdout.expected
264 ret=$?
265 if [ $ret -ne 0 ]; then
266 diff -u $testroot/stdout.expected $testroot/stdout
267 test_done "$testroot" "$ret"
268 return 1
271 got ref -l -r $testroot/repo > $testroot/stdout
272 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
273 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
274 echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
275 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
276 cmp -s $testroot/stdout $testroot/stdout.expected
277 ret=$?
278 if [ $ret -ne 0 ]; then
279 diff -u $testroot/stdout.expected $testroot/stdout
280 test_done "$testroot" "$ret"
281 return 1
284 got branch -d bogus_branch_name -r $testroot/repo \
285 > $testroot/stdout 2> $testroot/stderr
286 ret=$?
287 if [ $ret -eq 0 ]; then
288 echo "got branch succeeded unexpectedly"
289 test_done "$testroot" "1"
290 return 1
293 echo "got: reference refs/heads/bogus_branch_name not found" \
294 > $testroot/stderr.expected
295 cmp -s $testroot/stderr $testroot/stderr.expected
296 ret=$?
297 if [ $ret -ne 0 ]; then
298 diff -u $testroot/stderr.expected $testroot/stderr
299 test_done "$testroot" "$ret"
300 return 1
303 got ref -r $testroot/repo -c master refs/remotes/origin/master
304 got ref -r $testroot/repo -c branch1 refs/remotes/origin/branch1
305 got ref -r $testroot/repo -c branch3 refs/remotes/origin/branch3
307 got ref -l -r $testroot/repo > $testroot/stdout
308 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
309 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
310 echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
311 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
312 echo "refs/remotes/origin/branch1: $commit_id" \
313 >> $testroot/stdout.expected
314 echo "refs/remotes/origin/branch3: $commit_id" \
315 >> $testroot/stdout.expected
316 echo "refs/remotes/origin/master: $commit_id" \
317 >> $testroot/stdout.expected
318 cmp -s $testroot/stdout $testroot/stdout.expected
319 ret=$?
320 if [ $ret -ne 0 ]; then
321 diff -u $testroot/stdout.expected $testroot/stdout
322 test_done "$testroot" "$ret"
323 return 1
326 got branch -d origin/branch1 -r $testroot/repo > $testroot/stdout
327 ret=$?
328 if [ $ret -ne 0 ]; then
329 echo "got branch command failed unexpectedly"
330 test_done "$testroot" "$ret"
331 return 1
334 got branch -d refs/remotes/origin/branch3 -r $testroot/repo \
335 > $testroot/stdout
336 ret=$?
337 if [ $ret -ne 0 ]; then
338 echo "got branch command failed unexpectedly"
339 test_done "$testroot" "$ret"
340 return 1
343 got ref -l -r $testroot/repo > $testroot/stdout
344 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
345 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
346 echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
347 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
348 echo "refs/remotes/origin/master: $commit_id" \
349 >> $testroot/stdout.expected
350 cmp -s $testroot/stdout $testroot/stdout.expected
351 ret=$?
352 if [ $ret -ne 0 ]; then
353 diff -u $testroot/stdout.expected $testroot/stdout
355 test_done "$testroot" "$ret"
358 test_branch_delete_current_branch() {
359 local testroot=`test_init branch_delete_current_branch`
360 local commit_id=`git_show_head $testroot/repo`
362 got checkout $testroot/repo $testroot/wt >/dev/null
363 ret=$?
364 if [ $ret -ne 0 ]; then
365 echo "got checkout command failed unexpectedly"
366 test_done "$testroot" "$ret"
367 return 1
370 (cd $testroot/wt && got branch -d master > $testroot/stdout \
371 2> $testroot/stderr)
373 echo "got: will not delete this work tree's current branch" \
374 > $testroot/stderr.expected
375 cmp -s $testroot/stderr $testroot/stderr.expected
376 ret=$?
377 if [ $ret -ne 0 ]; then
378 diff -u $testroot/stderr.expected $testroot/stderr
380 test_done "$testroot" "$ret"
383 test_branch_delete_packed() {
384 local testroot=`test_init branch_delete_packed`
385 local commit_id=`git_show_head $testroot/repo`
387 for b in branch1 branch2 branch3; do
388 got branch -r $testroot/repo $b
389 ret=$?
390 if [ $ret -ne 0 ]; then
391 echo "got branch command failed unexpectedly"
392 test_done "$testroot" "$ret"
393 return 1
395 done
397 git -C $testroot/repo pack-refs --all
399 got branch -d refs/heads/branch2 -r $testroot/repo > $testroot/stdout
400 ret=$?
401 if [ $ret -ne 0 ]; then
402 echo "got update command failed unexpectedly"
403 test_done "$testroot" "$ret"
404 return 1
407 got branch -l -r $testroot/repo > $testroot/stdout
408 echo " branch1: $commit_id" > $testroot/stdout.expected
409 echo " branch3: $commit_id" >> $testroot/stdout.expected
410 echo " master: $commit_id" >> $testroot/stdout.expected
411 cmp -s $testroot/stdout $testroot/stdout.expected
412 ret=$?
413 if [ $ret -ne 0 ]; then
414 diff -u $testroot/stdout.expected $testroot/stdout
415 test_done "$testroot" "$ret"
416 return 1
419 got ref -l -r $testroot/repo > $testroot/stdout
420 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
421 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
422 echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
423 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
424 cmp -s $testroot/stdout $testroot/stdout.expected
425 ret=$?
426 if [ $ret -ne 0 ]; then
427 diff -u $testroot/stdout.expected $testroot/stdout
428 test_done "$testroot" "$ret"
429 return 1
432 got branch -d bogus_branch_name -r $testroot/repo \
433 > $testroot/stdout 2> $testroot/stderr
434 ret=$?
435 if [ $ret -eq 0 ]; then
436 echo "got update succeeded unexpectedly"
437 test_done "$testroot" "1"
438 return 1
441 echo "got: reference refs/heads/bogus_branch_name not found" \
442 > $testroot/stderr.expected
443 cmp -s $testroot/stderr $testroot/stderr.expected
444 ret=$?
445 if [ $ret -ne 0 ]; then
446 diff -u $testroot/stderr.expected $testroot/stderr
448 test_done "$testroot" "$ret"
451 test_branch_show() {
452 local testroot=`test_init branch_show`
453 local commit_id=`git_show_head $testroot/repo`
455 for b in branch1 branch2 branch3; do
456 got branch -r $testroot/repo $b
457 ret=$?
458 if [ $ret -ne 0 ]; then
459 echo "got branch command failed unexpectedly"
460 test_done "$testroot" "$ret"
461 return 1
463 done
465 got checkout $testroot/repo $testroot/wt >/dev/null
466 ret=$?
467 if [ $ret -ne 0 ]; then
468 echo "got checkout command failed unexpectedly"
469 test_done "$testroot" "$ret"
470 return 1
473 (cd $testroot/wt && got branch > $testroot/stdout)
474 echo "master" > $testroot/stdout.expected
475 cmp -s $testroot/stdout $testroot/stdout.expected
476 ret=$?
477 if [ $ret -ne 0 ]; then
478 diff -u $testroot/stdout.expected $testroot/stdout
479 test_done "$testroot" "$ret"
480 return 1
483 (cd $testroot/wt && got update -b branch1 > /dev/null)
484 ret=$?
485 if [ $ret -ne 0 ]; then
486 echo "got update command failed unexpectedly"
487 test_done "$testroot" "$ret"
488 return 1
491 (cd $testroot/wt && got branch > $testroot/stdout)
492 echo "branch1" > $testroot/stdout.expected
493 cmp -s $testroot/stdout $testroot/stdout.expected
494 ret=$?
495 if [ $ret -ne 0 ]; then
496 diff -u $testroot/stdout.expected $testroot/stdout
498 test_done "$testroot" "$ret"
502 test_branch_packed_ref_collision() {
503 local testroot=`test_init branch_packed_ref_collision`
504 local commit_id=`git_show_head $testroot/repo`
506 got br -r $testroot/repo zoo > $testroot/stdout
507 got co -b zoo $testroot/repo $testroot/wt > /dev/null
508 echo "modified alpha" > $testroot/wt/alpha
510 # sleep in order to ensure that a significant fraction of time
511 # passes between commits; required for got branch -t option below
512 sleep 1
514 (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
515 local commit_id2=`git_show_branch_head $testroot/repo zoo`
517 # Fabricate a packed reference which points to an older commit
518 # and collides with the existing on-disk reference
519 echo '# pack-refs with: peeled fully-peeled sorted' > \
520 $testroot/repo/.git/packed-refs
521 echo "$commit_id refs/heads/zoo" >> $testroot/repo/.git/packed-refs
523 # Bug: This command used to show both packed and on-disk
524 # variants of ref/heads/zoo:
525 (cd $testroot/wt && got br -lt > $testroot/stdout)
527 echo "~ zoo: $commit_id2" > $testroot/stdout.expected
528 echo " master: $commit_id" >> $testroot/stdout.expected
529 cmp -s $testroot/stdout $testroot/stdout.expected
530 ret=$?
531 if [ $ret -ne 0 ]; then
532 diff -u $testroot/stdout.expected $testroot/stdout
533 test_done "$testroot" "$ret"
534 return 1
537 test_done "$testroot" "$ret"
540 test_branch_commit_keywords() {
541 local testroot=$(test_init branch_commit_keywords)
543 set -- "$(git_show_head $testroot/repo)"
545 got checkout $testroot/repo $testroot/wt > /dev/null
546 ret=$?
547 if [ $ret -ne 0 ]; then
548 echo "checkout failed unexpectedly" >&2
549 test_done "$testroot" "$ret"
550 return 1
553 for i in $(seq 4); do
554 echo "beta change $i" > "$testroot/wt/beta"
556 (cd "$testroot/wt" && got ci -m "commit number $i" > /dev/null)
557 ret=$?
558 if [ $ret -ne 0 ]; then
559 echo "commit failed unexpectedly" >&2
560 test_done "$testroot" "$ret"
561 return 1
563 set -- "$@" "$(git_show_head $testroot/repo)"
564 done
566 (cd "$testroot/wt" && got up > /dev/null)
568 echo " kwbranch: $(pop_idx 3 $@)" > $testroot/stdout.expected
569 echo " master: $(pop_idx 5 $@)" >> $testroot/stdout.expected
571 (cd "$testroot/wt" && got br -nc :head:-2 kwbranch > /dev/null)
572 got br -r "$testroot/repo" -l > "$testroot/stdout"
574 cmp -s $testroot/stdout.expected $testroot/stdout
575 ret=$?
576 if [ $ret -ne 0 ]; then
577 diff -u $testroot/stdout.expected $testroot/stdout
578 test_done "$testroot" "$ret"
579 return 1
582 echo " kwbranch2: $(pop_idx 4 $@)" > $testroot/stdout.expected
584 got br -r "$testroot/repo" -c master:- kwbranch2 > /dev/null
585 got br -r "$testroot/repo" -l | grep kwbranch2 > "$testroot/stdout"
587 cmp -s $testroot/stdout.expected $testroot/stdout
588 ret=$?
589 if [ $ret -ne 0 ]; then
590 diff -u $testroot/stdout.expected $testroot/stdout
593 test_done "$testroot" "$ret"
596 test_branch_list_worktree_state() {
597 local testroot=$(test_init branch_list_worktree_state)
598 local wt="$testroot/wt"
600 set -- "$(git_show_head "$testroot/repo")"
602 got checkout "$testroot/repo" "$wt" > /dev/null
603 ret=$?
604 if [ $ret -ne 0 ]; then
605 echo "checkout failed unexpectedly" >&2
606 test_done "$testroot" "$ret"
607 return 1
610 (cd "$wt" && got br -n newbranch > /dev/null)
611 ret=$?
612 if [ $ret -ne 0 ]; then
613 echo "branch failed unexpectedly" >&2
614 test_done "$testroot" "$ret"
615 return 1
618 # check up-to-date marker is shown with fresh checkout
619 (cd "$wt" && got br -l > "$testroot/stdout")
620 echo "* master: $(pop_idx 1 $@)" > $testroot/stdout.expected
621 echo " newbranch: $(pop_idx 1 $@)" >> $testroot/stdout.expected
622 cmp -s $testroot/stdout $testroot/stdout.expected
623 ret=$?
624 if [ $ret -ne 0 ]; then
625 diff -u $testroot/stdout.expected $testroot/stdout
626 test_done "$testroot" "$ret"
627 return 1
630 # check out-of-date marker is shown with mixed-commit state
631 echo "mixed-commit" > "$wt/alpha"
632 (cd "$wt" && got commit -m "mixed-commit" > "$testroot/stdout")
633 set -- "$@" "$(git_show_head "$testroot/repo")"
635 (cd "$wt" && got br -l > "$testroot/stdout")
636 echo "~ master: $(pop_idx 2 $@)" > $testroot/stdout.expected
637 echo " newbranch: $(pop_idx 1 $@)" >> $testroot/stdout.expected
638 cmp -s $testroot/stdout $testroot/stdout.expected
639 ret=$?
640 if [ $ret -ne 0 ]; then
641 diff -u $testroot/stdout.expected $testroot/stdout
642 test_done "$testroot" "$ret"
643 return 1
646 # check up-to-date marker is shown after 'got update'
647 (cd "$wt" && got up > /dev/null)
648 (cd "$wt" && got br -l > "$testroot/stdout")
649 echo "* master: $(pop_idx 2 $@)" > $testroot/stdout.expected
650 echo " newbranch: $(pop_idx 1 $@)" >> $testroot/stdout.expected
651 cmp -s $testroot/stdout $testroot/stdout.expected
652 ret=$?
653 if [ $ret -ne 0 ]; then
654 diff -u $testroot/stdout.expected $testroot/stdout
655 test_done "$testroot" "$ret"
656 return 1
659 # check out-of-date marker is shown with out-of-date base commit
660 (cd "$wt" && got up -c:head:- > /dev/null)
661 (cd "$wt" && got br -l > "$testroot/stdout")
662 echo "~ master: $(pop_idx 2 $@)" > $testroot/stdout.expected
663 echo " newbranch: $(pop_idx 1 $@)" >> $testroot/stdout.expected
664 cmp -s $testroot/stdout $testroot/stdout.expected
665 ret=$?
666 if [ $ret -ne 0 ]; then
667 diff -u $testroot/stdout.expected $testroot/stdout
668 test_done "$testroot" "$ret"
669 return 1
672 test_done "$testroot" "$ret"
675 test_parseargs "$@"
676 run_test test_branch_create
677 run_test test_branch_list
678 run_test test_branch_delete
679 run_test test_branch_delete_current_branch
680 run_test test_branch_delete_packed
681 run_test test_branch_show
682 run_test test_branch_packed_ref_collision
683 run_test test_branch_commit_keywords
684 run_test test_branch_list_worktree_state