3 # Copyright (c) 2021 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.
20 local testroot=`test_init send_basic`
21 local testurl=ssh://127.0.0.1/$testroot
22 local commit_id=`git_show_head $testroot/repo`
24 got clone -q $testurl/repo $testroot/repo-clone
26 if [ "$ret" != "0" ]; then
27 echo "got clone command failed unexpectedly" >&2
28 test_done "$testroot" "$ret"
31 cat > $testroot/repo/.git/got.conf <<EOF
35 repository "$testroot/repo-clone"
38 got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
39 tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
40 | tr -d ' ' | cut -d: -f2`
42 echo "modified alpha" > $testroot/repo/alpha
43 (cd $testroot/repo && git rm -q beta)
44 (cd $testroot/repo && ln -s epsilon/zeta symlink && git add symlink)
45 echo "new file alpha" > $testroot/repo/new
46 (cd $testroot/repo && git add new)
47 git_commit $testroot/repo -m "modified alpha"
48 local commit_id2=`git_show_head $testroot/repo`
50 got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
52 if [ "$ret" != "0" ]; then
53 echo "got send command failed unexpectedly" >&2
54 test_done "$testroot" "$ret"
58 echo -n > $testroot/stdout.expected
59 cmp -s $testroot/stdout $testroot/stdout.expected
61 if [ "$ret" != "0" ]; then
62 diff -u $testroot/stdout.expected $testroot/stdout
63 test_done "$testroot" "$ret"
67 got ref -l -r $testroot/repo > $testroot/stdout
68 if [ "$ret" != "0" ]; then
69 echo "got ref command failed unexpectedly" >&2
70 test_done "$testroot" "$ret"
74 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
75 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
76 echo "refs/remotes/origin/master: $commit_id2" \
77 >> $testroot/stdout.expected
78 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
80 cmp -s $testroot/stdout $testroot/stdout.expected
82 if [ "$ret" != "0" ]; then
83 diff -u $testroot/stdout.expected $testroot/stdout
84 test_done "$testroot" "$ret"
88 got ref -l -r $testroot/repo-clone > $testroot/stdout
89 if [ "$ret" != "0" ]; then
90 echo "got ref command failed unexpectedly" >&2
91 test_done "$testroot" "$ret"
95 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
96 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
97 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
98 >> $testroot/stdout.expected
99 echo "refs/remotes/origin/master: $commit_id" \
100 >> $testroot/stdout.expected
102 cmp -s $testroot/stdout $testroot/stdout.expected
104 if [ "$ret" != "0" ]; then
105 diff -u $testroot/stdout.expected $testroot/stdout
106 test_done "$testroot" "$ret"
110 got tree -r $testroot/repo-clone -c $commit_id2 -i -R \
112 got tree -r $testroot/repo -c $commit_id2 -i -R \
113 > $testroot/stdout.expected
114 cmp -s $testroot/stdout $testroot/stdout.expected
116 if [ "$ret" != "0" ]; then
117 diff -u $testroot/stdout.expected $testroot/stdout
118 test_done "$testroot" "$ret"
122 got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
124 if [ "$ret" != "0" ]; then
125 echo "got send command failed unexpectedly" >&2
126 test_done "$testroot" "$ret"
130 echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
131 echo "Already up-to-date" >> $testroot/stdout.expected
132 cmp -s $testroot/stdout $testroot/stdout.expected
134 if [ "$ret" != "0" ]; then
135 diff -u $testroot/stdout.expected $testroot/stdout
136 test_done "$testroot" "$ret"
140 git_fsck "$testroot" "$testroot/repo-clone"
142 test_done "$testroot" "$ret"
145 test_send_rebase_required() {
146 local testroot=`test_init send_rebase_required`
147 local testurl=ssh://127.0.0.1/$testroot
148 local commit_id=`git_show_head $testroot/repo`
150 got clone -q $testurl/repo $testroot/repo-clone
152 if [ "$ret" != "0" ]; then
153 echo "got clone command failed unexpectedly" >&2
154 test_done "$testroot" "$ret"
157 cat > $testroot/repo/.git/got.conf <<EOF
161 repository "$testroot/repo-clone"
164 echo "modified alpha" > $testroot/repo/alpha
165 git_commit $testroot/repo -m "modified alpha"
166 local commit_id2=`git_show_head $testroot/repo`
168 got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
169 echo "modified alpha, too" > $testroot/wt-clone/alpha
170 (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
172 got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
174 if [ "$ret" = "0" ]; then
175 echo "got send command succeeded unexpectedly" >&2
176 test_done "$testroot" "$ret"
180 echo -n > $testroot/stdout.expected
181 cmp -s $testroot/stdout $testroot/stdout.expected
183 if [ "$ret" != "0" ]; then
184 diff -u $testroot/stdout.expected $testroot/stdout
185 test_done "$testroot" "$ret"
189 echo "got: refs/heads/master: fetch and rebase required" \
190 > $testroot/stderr.expected
191 cmp -s $testroot/stderr $testroot/stderr.expected
193 if [ "$ret" != "0" ]; then
194 diff -u $testroot/stderr.expected $testroot/stderr
195 test_done "$testroot" "$ret"
199 git_fsck "$testroot" "$testroot/repo-clone"
201 test_done "$testroot" "$ret"
204 test_send_rebase_required_overwrite() {
205 local testroot=`test_init send_rebase_required_overwrite`
206 local testurl=ssh://127.0.0.1/$testroot
207 local commit_id=`git_show_head $testroot/repo`
209 got clone -q $testurl/repo $testroot/repo-clone
211 if [ "$ret" != "0" ]; then
212 echo "got clone command failed unexpectedly" >&2
213 test_done "$testroot" "$ret"
216 cat > $testroot/repo/.git/got.conf <<EOF
220 repository "$testroot/repo-clone"
223 echo "modified alpha" > $testroot/repo/alpha
224 git_commit $testroot/repo -m "modified alpha"
225 local commit_id2=`git_show_head $testroot/repo`
227 got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
228 echo "modified alpha, too" > $testroot/wt-clone/alpha
229 (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
230 local commit_id3=`git_show_head $testroot/repo-clone`
232 # non-default remote requires an explicit argument
233 got send -q -r $testroot/repo -f > $testroot/stdout \
236 if [ "$ret" = "0" ]; then
237 echo "got send command succeeded unexpectedly" >&2
238 test_done "$testroot" "$ret"
241 echo "got: origin: remote repository not found" \
242 > $testroot/stderr.expected
243 cmp -s $testroot/stderr $testroot/stderr.expected
245 if [ "$ret" != "0" ]; then
246 diff -u $testroot/stderr.expected $testroot/stderr
247 test_done "$testroot" "$ret"
251 got send -q -r $testroot/repo -f foobar > $testroot/stdout \
254 if [ "$ret" != "0" ]; then
255 echo "got send command failed unexpectedly" >&2
256 test_done "$testroot" "$ret"
260 echo -n > $testroot/stdout.expected
261 cmp -s $testroot/stdout $testroot/stdout.expected
263 if [ "$ret" != "0" ]; then
264 diff -u $testroot/stdout.expected $testroot/stdout
265 test_done "$testroot" "$ret"
269 got ref -l -r $testroot/repo > $testroot/stdout
270 if [ "$ret" != "0" ]; then
271 echo "got ref command failed unexpectedly" >&2
272 test_done "$testroot" "$ret"
276 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
277 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
278 echo "refs/remotes/foobar/master: $commit_id2" \
279 >> $testroot/stdout.expected
281 cmp -s $testroot/stdout $testroot/stdout.expected
283 if [ "$ret" != "0" ]; then
284 diff -u $testroot/stdout.expected $testroot/stdout
285 test_done "$testroot" "$ret"
289 got ref -l -r $testroot/repo-clone > $testroot/stdout
290 if [ "$ret" != "0" ]; then
291 echo "got ref command failed unexpectedly" >&2
292 test_done "$testroot" "$ret"
296 wt_uuid=`(cd $testroot/wt-clone && got info | grep 'UUID:' | \
297 cut -d ':' -f 2 | tr -d ' ')`
298 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
299 echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
300 >> $testroot/stdout.expected
301 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
302 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
303 >> $testroot/stdout.expected
304 echo "refs/remotes/origin/master: $commit_id" \
305 >> $testroot/stdout.expected
307 cmp -s $testroot/stdout $testroot/stdout.expected
309 if [ "$ret" != "0" ]; then
310 diff -u $testroot/stdout.expected $testroot/stdout
311 test_done "$testroot" "$ret"
315 git_fsck "$testroot" "$testroot/repo-clone"
317 test_done "$testroot" "$ret"
321 local testroot=`test_init send_delete`
322 local testurl=ssh://127.0.0.1/$testroot
323 local commit_id=`git_show_head $testroot/repo`
325 # branch1 exists in both repositories
326 got branch -r $testroot/repo branch1
328 got clone -a -q $testurl/repo $testroot/repo-clone
330 if [ "$ret" != "0" ]; then
331 echo "got clone command failed unexpectedly" >&2
332 test_done "$testroot" "$ret"
335 cat > $testroot/repo/.git/got.conf <<EOF
339 repository "$testroot/repo-clone"
342 # branch2 exists only in the remote repository
343 got branch -r $testroot/repo-clone branch2
345 got ref -l -r $testroot/repo-clone > $testroot/stdout
346 if [ "$ret" != "0" ]; then
347 echo "got ref command failed unexpectedly" >&2
348 test_done "$testroot" "$ret"
352 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
353 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
354 echo "refs/heads/branch2: $commit_id" >> $testroot/stdout.expected
355 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
357 # Sending changes for a branch and deleting it at the same
358 # time is not allowed.
359 got send -q -r $testroot/repo -d branch1 -b branch1 \
360 > $testroot/stdout 2> $testroot/stderr
362 if [ "$ret" = "0" ]; then
363 echo "got send command succeeded unexpectedly" >&2
364 test_done "$testroot" "$ret"
367 echo -n "got: changes on refs/heads/branch1 will be sent to server" \
368 > $testroot/stderr.expected
369 echo ": reference cannot be deleted" >> $testroot/stderr.expected
370 cmp -s $testroot/stderr $testroot/stderr.expected
372 if [ "$ret" != "0" ]; then
373 diff -u $testroot/stderr.expected $testroot/stderr
374 test_done "$testroot" "$ret"
378 got send -q -r $testroot/repo -d refs/heads/branch1 origin \
379 > $testroot/stdout 2> $testroot/stderr
381 if [ "$ret" != "0" ]; then
382 echo "got send command failed unexpectedly" >&2
383 test_done "$testroot" "$ret"
387 got send -r $testroot/repo -d refs/heads/branch2 origin \
388 > $testroot/stdout 2>$testroot/stderr
390 if [ "$ret" != "0" ]; then
391 echo "got send command failed unexpectedly" >&2
392 test_done "$testroot" "$ret"
396 echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
397 echo "Server has deleted refs/heads/branch2" \
398 >> $testroot/stdout.expected
400 cmp -s $testroot/stdout $testroot/stdout.expected
402 if [ "$ret" != "0" ]; then
403 diff -u $testroot/stdout.expected $testroot/stdout
404 test_done "$testroot" "$ret"
408 # branchX exists in neither repository
409 got send -q -r $testroot/repo -d refs/heads/branchX origin \
410 > $testroot/stdout 2> $testroot/stderr
412 if [ "$ret" = "0" ]; then
413 echo "got send command succeeded unexpectedly" >&2
414 test_done "$testroot" "$ret"
417 echo -n "got-send-pack: refs/heads/branchX does not exist in remote " \
418 > $testroot/stderr.expected
419 echo "repository: no such reference found" >> $testroot/stderr.expected
420 echo "got: no such reference found" >> $testroot/stderr.expected
421 cmp -s $testroot/stderr $testroot/stderr.expected
423 if [ "$ret" != "0" ]; then
424 diff -u $testroot/stderr.expected $testroot/stderr
425 test_done "$testroot" "$ret"
429 # References outside of refs/heads/ cannot be deleted with 'got send'.
430 got send -q -r $testroot/repo -d refs/tags/1.0 origin \
431 > $testroot/stdout 2> $testroot/stderr
433 if [ "$ret" = "0" ]; then
434 echo "got send command succeeded unexpectedly" >&2
435 test_done "$testroot" "$ret"
438 echo -n "got-send-pack: refs/heads/refs/tags/1.0 does not exist " \
439 > $testroot/stderr.expected
440 echo "in remote repository: no such reference found" \
441 >> $testroot/stderr.expected
442 echo "got: no such reference found" >> $testroot/stderr.expected
443 cmp -s $testroot/stderr $testroot/stderr.expected
445 if [ "$ret" != "0" ]; then
446 diff -u $testroot/stderr.expected $testroot/stderr
447 test_done "$testroot" "$ret"
451 got ref -l -r $testroot/repo > $testroot/stdout
452 if [ "$ret" != "0" ]; then
453 echo "got ref command failed unexpectedly" >&2
454 test_done "$testroot" "$ret"
458 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
459 echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
460 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
462 cmp -s $testroot/stdout $testroot/stdout.expected
464 if [ "$ret" != "0" ]; then
465 diff -u $testroot/stdout.expected $testroot/stdout
466 test_done "$testroot" "$ret"
470 got ref -l -r $testroot/repo-clone > $testroot/stdout
471 if [ "$ret" != "0" ]; then
472 echo "got ref command failed unexpectedly" >&2
473 test_done "$testroot" "$ret"
477 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
478 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
479 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
480 >> $testroot/stdout.expected
481 echo "refs/remotes/origin/branch1: $commit_id" \
482 >> $testroot/stdout.expected
483 echo "refs/remotes/origin/master: $commit_id" \
484 >> $testroot/stdout.expected
486 cmp -s $testroot/stdout $testroot/stdout.expected
488 if [ "$ret" != "0" ]; then
489 diff -u $testroot/stdout.expected $testroot/stdout
490 test_done "$testroot" "$ret"
494 git_fsck "$testroot" "$testroot/repo-clone"
496 test_done "$testroot" "$ret"
499 test_send_clone_and_send() {
500 local testroot=`test_init send_clone_and_send`
501 local testurl=ssh://127.0.0.1/$testroot
502 local commit_id=`git_show_head $testroot/repo`
504 (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
506 got clone -q $testurl/repo $testroot/repo-clone
508 if [ "$ret" != "0" ]; then
509 echo "got clone command failed unexpectedly" >&2
510 test_done "$testroot" "$ret"
514 got checkout $testroot/repo-clone $testroot/wt >/dev/null
515 echo "modified alpha" > $testroot/wt/alpha
516 (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
517 local commit_id2=`git_show_head $testroot/repo-clone`
519 (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
521 if [ "$ret" != "0" ]; then
522 echo "got send command failed unexpectedly" >&2
523 test_done "$testroot" "$ret"
527 echo -n > $testroot/stdout.expected
528 cmp -s $testroot/stdout $testroot/stdout.expected
530 if [ "$ret" != "0" ]; then
531 diff -u $testroot/stdout.expected $testroot/stdout
532 test_done "$testroot" "$ret"
536 got ref -l -r $testroot/repo > $testroot/stdout
537 if [ "$ret" != "0" ]; then
538 echo "got ref command failed unexpectedly" >&2
539 test_done "$testroot" "$ret"
543 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
544 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
546 cmp -s $testroot/stdout $testroot/stdout.expected
548 if [ "$ret" != "0" ]; then
549 diff -u $testroot/stdout.expected $testroot/stdout
550 test_done "$testroot" "$ret"
554 got ref -l -r $testroot/repo-clone > $testroot/stdout
555 if [ "$ret" != "0" ]; then
556 echo "got ref command failed unexpectedly" >&2
557 test_done "$testroot" "$ret"
561 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
562 cut -d ':' -f 2 | tr -d ' ')`
563 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
564 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
565 >> $testroot/stdout.expected
566 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
567 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
568 >> $testroot/stdout.expected
569 echo "refs/remotes/origin/master: $commit_id2" \
570 >> $testroot/stdout.expected
572 cmp -s $testroot/stdout $testroot/stdout.expected
574 if [ "$ret" != "0" ]; then
575 diff -u $testroot/stdout.expected $testroot/stdout
576 test_done "$testroot" "$ret"
580 git_fsck "$testroot" "$testroot/repo-clone"
582 test_done "$testroot" "$ret"
586 local testroot=`test_init send_tags`
587 local testurl=ssh://127.0.0.1/$testroot
588 local commit_id=`git_show_head $testroot/repo`
590 got clone -q $testurl/repo $testroot/repo-clone
592 if [ "$ret" != "0" ]; then
593 echo "got clone command failed unexpectedly" >&2
594 test_done "$testroot" "$ret"
597 cat > $testroot/repo/.git/got.conf <<EOF
601 repository "$testroot/repo-clone"
604 got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
605 tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
606 | tr -d ' ' | cut -d: -f2`
608 echo "modified alpha" > $testroot/repo/alpha
609 git_commit $testroot/repo -m "modified alpha"
610 local commit_id2=`git_show_head $testroot/repo`
612 got tag -r $testroot/repo -m '2.0' 2.0 >/dev/null
613 tag_id2=`got ref -r $testroot/repo -l | grep "^refs/tags/2.0" \
614 | tr -d ' ' | cut -d: -f2`
616 got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
618 if [ "$ret" != "0" ]; then
619 echo "got send command failed unexpectedly" >&2
620 test_done "$testroot" "$ret"
624 echo -n > $testroot/stdout.expected
625 cmp -s $testroot/stdout $testroot/stdout.expected
627 if [ "$ret" != "0" ]; then
628 diff -u $testroot/stdout.expected $testroot/stdout
629 test_done "$testroot" "$ret"
633 got ref -l -r $testroot/repo > $testroot/stdout
634 if [ "$ret" != "0" ]; then
635 echo "got ref command failed unexpectedly" >&2
636 test_done "$testroot" "$ret"
640 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
641 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
642 echo "refs/remotes/origin/master: $commit_id2" \
643 >> $testroot/stdout.expected
644 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
645 echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
647 cmp -s $testroot/stdout $testroot/stdout.expected
649 if [ "$ret" != "0" ]; then
650 diff -u $testroot/stdout.expected $testroot/stdout
651 test_done "$testroot" "$ret"
655 got ref -l -r $testroot/repo-clone > $testroot/stdout
656 if [ "$ret" != "0" ]; then
657 echo "got ref command failed unexpectedly" >&2
658 test_done "$testroot" "$ret"
662 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
663 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
664 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
665 >> $testroot/stdout.expected
666 echo "refs/remotes/origin/master: $commit_id" \
667 >> $testroot/stdout.expected
668 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
669 echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
671 cmp -s $testroot/stdout $testroot/stdout.expected
673 if [ "$ret" != "0" ]; then
674 diff -u $testroot/stdout.expected $testroot/stdout
675 test_done "$testroot" "$ret"
679 got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
680 echo "tag 1.0 $tag_id" > $testroot/stdout.expected
681 echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
682 cmp -s $testroot/stdout $testroot/stdout.expected
684 if [ "$ret" != "0" ]; then
685 diff -u $testroot/stdout.expected $testroot/stdout
686 test_done "$testroot" "$ret"
690 # Overwriting an existing tag 'got send -f'.
691 got ref -r $testroot/repo -d refs/tags/1.0 >/dev/null
692 got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
693 tag_id3=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
694 | tr -d ' ' | cut -d: -f2`
696 got send -q -r $testroot/repo -t 1.0 > $testroot/stdout \
699 if [ "$ret" = "0" ]; then
700 echo "got send command succeeded unexpectedly" >&2
701 test_done "$testroot" "$ret"
705 echo "got: refs/tags/1.0: tag already exists on server" \
706 > $testroot/stderr.expected
707 cmp -s $testroot/stderr $testroot/stderr.expected
709 if [ "$ret" != "0" ]; then
710 diff -u $testroot/stderr.expected $testroot/stderr
711 test_done "$testroot" "$ret"
715 # attempting the same with -T should fail, too
716 got send -q -r $testroot/repo -T > $testroot/stdout \
719 if [ "$ret" = "0" ]; then
720 echo "got send command succeeded unexpectedly" >&2
721 test_done "$testroot" "$ret"
725 echo "got: refs/tags/1.0: tag already exists on server" \
726 > $testroot/stderr.expected
727 cmp -s $testroot/stderr $testroot/stderr.expected
729 if [ "$ret" != "0" ]; then
730 diff -u $testroot/stderr.expected $testroot/stderr
731 test_done "$testroot" "$ret"
735 got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
736 echo "tag 1.0 $tag_id" > $testroot/stdout.expected
737 echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
738 cmp -s $testroot/stdout $testroot/stdout.expected
740 if [ "$ret" != "0" ]; then
741 diff -u $testroot/stdout.expected $testroot/stdout
742 test_done "$testroot" "$ret"
746 # overwrite the 1.0 tag only
747 got send -q -r $testroot/repo -t 1.0 -f > $testroot/stdout \
750 if [ "$ret" != "0" ]; then
751 echo "got send command failed unexpectedly" >&2
752 test_done "$testroot" "$ret"
756 got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
757 echo "tag 1.0 $tag_id3" > $testroot/stdout.expected
758 echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
759 cmp -s $testroot/stdout $testroot/stdout.expected
761 if [ "$ret" != "0" ]; then
762 diff -u $testroot/stdout.expected $testroot/stdout
763 test_done "$testroot" "$ret"
767 got checkout $testroot/repo $testroot/wt > /dev/null
768 echo 'new line in file alpha' >> $testroot/wt/alpha
769 (cd $testroot/wt && got commit -m 'changing file alpha' > /dev/null)
771 # Send the new commit in isolation.
772 got send -q -r $testroot/repo > $testroot/stdout \
775 if [ "$ret" != "0" ]; then
776 echo "got send command failed unexpectedly" >&2
777 test_done "$testroot" "$ret"
781 # Now tag it and send the tag.
782 # Verify that just the new tag object gets sent.
783 got tag -r $testroot/repo -m '3.0' 3.0 >/dev/null
784 tag_id4=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
785 | tr -d ' ' | cut -d: -f2`
787 got send -r $testroot/repo -t 3.0 > $testroot/stdout.raw \
790 if [ "$ret" != "0" ]; then
791 echo "got send command failed unexpectedly" >&2
792 test_done "$testroot" "$ret"
795 tr -d '\r' < $testroot/stdout.raw > $testroot/stdout
796 if ! grep -q "packing 2 references; 1 object; deltify: 100%" \
797 $testroot/stdout; then
798 echo "got send did apparently pack too many objects:" >&2
799 cat $testroot/stdout.raw >&2
800 test_done "$testroot" "1"
804 git_fsck "$testroot" "$testroot/repo-clone"
806 test_done "$testroot" "$ret"
809 test_send_tag_of_deleted_branch() {
810 local testroot=`test_init send_tag_of_deleted_branch`
811 local testurl=ssh://127.0.0.1/$testroot
812 local commit_id=`git_show_head $testroot/repo`
814 got clone -q $testurl/repo $testroot/repo-clone
816 if [ "$ret" != "0" ]; then
817 echo "got clone command failed unexpectedly" >&2
818 test_done "$testroot" "$ret"
821 cat > $testroot/repo/.git/got.conf <<EOF
825 repository "$testroot/repo-clone"
828 got branch -r $testroot/repo foo
830 # modify alpha on branch foo
831 got checkout -b foo $testroot/repo $testroot/wt > /dev/null
832 echo boo >> $testroot/wt/beta
833 (cd $testroot/wt && got commit -m 'changed beta on branch foo' \
835 local commit_id2=`git_show_branch_head $testroot/repo foo`
837 # tag HEAD commit of branch foo
838 got tag -r $testroot/repo -c foo -m '1.0' 1.0 > /dev/null
839 tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
840 | tr -d ' ' | cut -d: -f2`
842 # delete the branch; commit is now only reachable via tags/1.0
843 got branch -r $testroot/repo -d foo > /dev/null
845 # unrelated change on master branch, then try sending this branch
847 echo "modified alpha" > $testroot/repo/alpha
848 git_commit $testroot/repo -m "modified alpha"
849 local commit_id3=`git_show_head $testroot/repo`
851 got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
853 if [ "$ret" != "0" ]; then
854 echo "got send command failed unexpectedly" >&2
855 test_done "$testroot" "$ret"
859 echo -n > $testroot/stdout.expected
860 cmp -s $testroot/stdout $testroot/stdout.expected
862 if [ "$ret" != "0" ]; then
863 diff -u $testroot/stdout.expected $testroot/stdout
864 test_done "$testroot" "$ret"
868 got ref -l -r $testroot/repo > $testroot/stdout
869 if [ "$ret" != "0" ]; then
870 echo "got ref command failed unexpectedly" >&2
871 test_done "$testroot" "$ret"
875 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
876 cut -d ':' -f 2 | tr -d ' ')`
877 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
878 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
879 >> $testroot/stdout.expected
880 echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
881 echo "refs/remotes/origin/master: $commit_id3" \
882 >> $testroot/stdout.expected
883 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
885 cmp -s $testroot/stdout $testroot/stdout.expected
887 if [ "$ret" != "0" ]; then
888 diff -u $testroot/stdout.expected $testroot/stdout
889 test_done "$testroot" "$ret"
893 got ref -l -r $testroot/repo-clone > $testroot/stdout
894 if [ "$ret" != "0" ]; then
895 echo "got ref command failed unexpectedly" >&2
896 test_done "$testroot" "$ret"
900 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
901 echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
902 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
903 >> $testroot/stdout.expected
904 echo "refs/remotes/origin/master: $commit_id" \
905 >> $testroot/stdout.expected
906 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
908 cmp -s $testroot/stdout $testroot/stdout.expected
910 if [ "$ret" != "0" ]; then
911 diff -u $testroot/stdout.expected $testroot/stdout
912 test_done "$testroot" "$ret"
916 got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
917 echo "tag 1.0 $tag_id" > $testroot/stdout.expected
919 cmp -s $testroot/stdout $testroot/stdout.expected
921 if [ "$ret" != "0" ]; then
922 diff -u $testroot/stdout.expected $testroot/stdout
923 test_done "$testroot" "$ret"
927 git_fsck "$testroot" "$testroot/repo-clone"
929 test_done "$testroot" "$ret"
932 test_send_new_branch() {
933 local testroot=`test_init send_new_branch`
934 local testurl=ssh://127.0.0.1/$testroot
935 local commit_id=`git_show_head $testroot/repo`
937 (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
939 got clone -q $testurl/repo $testroot/repo-clone
941 if [ "$ret" != "0" ]; then
942 echo "got clone command failed unexpectedly" >&2
943 test_done "$testroot" "$ret"
947 got branch -r $testroot/repo-clone foo >/dev/null
948 got checkout -b foo $testroot/repo-clone $testroot/wt >/dev/null
949 echo "modified alpha" > $testroot/wt/alpha
950 (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
951 local commit_id2=`git_show_branch_head $testroot/repo-clone foo`
953 (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
955 if [ "$ret" != "0" ]; then
956 echo "got send command failed unexpectedly" >&2
957 test_done "$testroot" "$ret"
961 echo -n > $testroot/stdout.expected
962 cmp -s $testroot/stdout $testroot/stdout.expected
964 if [ "$ret" != "0" ]; then
965 diff -u $testroot/stdout.expected $testroot/stdout
966 test_done "$testroot" "$ret"
970 got ref -l -r $testroot/repo > $testroot/stdout
971 if [ "$ret" != "0" ]; then
972 echo "got ref command failed unexpectedly" >&2
973 test_done "$testroot" "$ret"
977 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
978 echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
979 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
981 cmp -s $testroot/stdout $testroot/stdout.expected
983 if [ "$ret" != "0" ]; then
984 diff -u $testroot/stdout.expected $testroot/stdout
985 test_done "$testroot" "$ret"
989 got ref -l -r $testroot/repo-clone > $testroot/stdout
990 if [ "$ret" != "0" ]; then
991 echo "got ref command failed unexpectedly" >&2
992 test_done "$testroot" "$ret"
996 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
997 cut -d ':' -f 2 | tr -d ' ')`
998 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
999 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1000 >> $testroot/stdout.expected
1001 echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
1002 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1003 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1004 >> $testroot/stdout.expected
1005 echo "refs/remotes/origin/foo: $commit_id2" \
1006 >> $testroot/stdout.expected
1007 echo "refs/remotes/origin/master: $commit_id" \
1008 >> $testroot/stdout.expected
1010 cmp -s $testroot/stdout $testroot/stdout.expected
1012 if [ "$ret" != "0" ]; then
1013 diff -u $testroot/stdout.expected $testroot/stdout
1014 test_done "$testroot" "$ret"
1018 git_fsck "$testroot" "$testroot/repo-clone"
1020 test_done "$testroot" "$ret"
1023 test_send_all_branches() {
1024 local testroot=`test_init send_all_branches`
1025 local testurl=ssh://127.0.0.1/$testroot
1026 local commit_id=`git_show_head $testroot/repo`
1028 (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
1030 got clone -q $testurl/repo $testroot/repo-clone
1032 if [ "$ret" != "0" ]; then
1033 echo "got clone command failed unexpectedly" >&2
1034 test_done "$testroot" "$ret"
1038 got checkout $testroot/repo-clone $testroot/wt >/dev/null
1039 echo "modified alpha" > $testroot/wt/alpha
1040 (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
1041 local commit_id2=`git_show_head $testroot/repo-clone`
1043 got branch -r $testroot/repo-clone foo >/dev/null
1044 (cd $testroot/wt && got update -b foo >/dev/null)
1045 echo "modified beta on new branch foo" > $testroot/wt/beta
1046 (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1047 local commit_id3=`git_show_branch_head $testroot/repo-clone foo`
1049 got branch -r $testroot/repo-clone bar >/dev/null
1050 (cd $testroot/wt && got update -b bar >/dev/null)
1051 echo "modified beta again on new branch bar" > $testroot/wt/beta
1052 (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1053 local commit_id4=`git_show_branch_head $testroot/repo-clone bar`
1055 got ref -l -r $testroot/repo-clone > $testroot/stdout
1056 if [ "$ret" != "0" ]; then
1057 echo "got ref command failed unexpectedly" >&2
1058 test_done "$testroot" "$ret"
1062 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1063 echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1064 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1065 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1067 got send -a -q -r $testroot/repo-clone -b master > $testroot/stdout \
1070 if [ "$ret" = "0" ]; then
1071 echo "got send command succeeded unexpectedly" >&2
1072 test_done "$testroot" "$ret"
1075 echo "got: -a and -b options are mutually exclusive" \
1076 > $testroot/stderr.expected
1077 cmp -s $testroot/stderr $testroot/stderr.expected
1079 if [ "$ret" != "0" ]; then
1080 diff -u $testroot/stderr.expected $testroot/stderr
1081 test_done "$testroot" "$ret"
1085 got send -a -q -r $testroot/repo-clone > $testroot/stdout \
1088 if [ "$ret" != "0" ]; then
1089 echo "got send command failed unexpectedly" >&2
1090 test_done "$testroot" "$ret"
1094 echo -n > $testroot/stdout.expected
1095 cmp -s $testroot/stdout $testroot/stdout.expected
1097 if [ "$ret" != "0" ]; then
1098 diff -u $testroot/stdout.expected $testroot/stdout
1099 test_done "$testroot" "$ret"
1103 got ref -l -r $testroot/repo > $testroot/stdout
1104 if [ "$ret" != "0" ]; then
1105 echo "got ref command failed unexpectedly" >&2
1106 test_done "$testroot" "$ret"
1110 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1111 echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1112 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1113 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1115 cmp -s $testroot/stdout $testroot/stdout.expected
1117 if [ "$ret" != "0" ]; then
1118 diff -u $testroot/stdout.expected $testroot/stdout
1119 test_done "$testroot" "$ret"
1123 got ref -l -r $testroot/repo-clone > $testroot/stdout
1124 if [ "$ret" != "0" ]; then
1125 echo "got ref command failed unexpectedly" >&2
1126 test_done "$testroot" "$ret"
1130 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1131 cut -d ':' -f 2 | tr -d ' ')`
1132 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1133 echo "refs/got/worktree/base-$wt_uuid: $commit_id4" \
1134 >> $testroot/stdout.expected
1135 echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1136 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1137 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1138 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1139 >> $testroot/stdout.expected
1140 echo "refs/remotes/origin/bar: $commit_id4" \
1141 >> $testroot/stdout.expected
1142 echo "refs/remotes/origin/foo: $commit_id3" \
1143 >> $testroot/stdout.expected
1144 echo "refs/remotes/origin/master: $commit_id2" \
1145 >> $testroot/stdout.expected
1147 cmp -s $testroot/stdout $testroot/stdout.expected
1149 if [ "$ret" != "0" ]; then
1150 diff -u $testroot/stdout.expected $testroot/stdout
1151 test_done "$testroot" "$ret"
1155 git_fsck "$testroot" "$testroot/repo-clone"
1157 test_done "$testroot" "$ret"
1160 test_send_to_empty_repo() {
1161 local testroot=`test_init send_to_empty_repo`
1162 local testurl=ssh://127.0.0.1/$testroot
1163 local commit_id=`git_show_head $testroot/repo`
1165 got init $testroot/repo2
1168 if [ "$ret" != "0" ]; then
1169 echo "got clone command failed unexpectedly" >&2
1170 test_done "$testroot" "$ret"
1173 cat > $testroot/repo/.git/got.conf <<EOF
1177 repository "$testroot/repo2"
1180 echo "modified alpha" > $testroot/repo/alpha
1181 git_commit $testroot/repo -m "modified alpha"
1182 local commit_id2=`git_show_head $testroot/repo`
1184 got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1186 if [ "$ret" != "0" ]; then
1187 echo "got send command failed unexpectedly" >&2
1188 test_done "$testroot" "$ret"
1192 echo -n > $testroot/stdout.expected
1193 cmp -s $testroot/stdout $testroot/stdout.expected
1195 if [ "$ret" != "0" ]; then
1196 diff -u $testroot/stdout.expected $testroot/stdout
1197 test_done "$testroot" "$ret"
1201 # XXX Workaround: We cannot give the target for HEAD to 'got init'
1202 got ref -r $testroot/repo2 -s refs/heads/master HEAD
1204 got ref -l -r $testroot/repo > $testroot/stdout
1205 if [ "$ret" != "0" ]; then
1206 echo "got ref command failed unexpectedly" >&2
1207 test_done "$testroot" "$ret"
1211 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1212 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1213 echo "refs/remotes/origin/master: $commit_id2" \
1214 >> $testroot/stdout.expected
1216 cmp -s $testroot/stdout $testroot/stdout.expected
1218 if [ "$ret" != "0" ]; then
1219 diff -u $testroot/stdout.expected $testroot/stdout
1220 test_done "$testroot" "$ret"
1224 got ref -l -r $testroot/repo2 > $testroot/stdout
1225 if [ "$ret" != "0" ]; then
1226 echo "got ref command failed unexpectedly" >&2
1227 test_done "$testroot" "$ret"
1231 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1232 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1234 cmp -s $testroot/stdout $testroot/stdout.expected
1236 if [ "$ret" != "0" ]; then
1237 diff -u $testroot/stdout.expected $testroot/stdout
1238 test_done "$testroot" "$ret"
1242 got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1244 if [ "$ret" != "0" ]; then
1245 echo "got send command failed unexpectedly" >&2
1246 test_done "$testroot" "$ret"
1250 echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
1251 echo "Already up-to-date" >> $testroot/stdout.expected
1252 cmp -s $testroot/stdout $testroot/stdout.expected
1254 if [ "$ret" != "0" ]; then
1255 diff -u $testroot/stdout.expected $testroot/stdout
1256 test_done "$testroot" "$ret"
1260 git_fsck "$testroot" "$testroot/repo2"
1262 test_done "$testroot" "$ret"
1265 test_send_and_fetch_config() {
1266 local testroot=`test_init send_fetch_conf`
1267 local testurl=ssh://127.0.0.1/$testroot
1268 local commit_id=`git_show_head $testroot/repo`
1270 got clone -q $testurl/repo $testroot/repo-clone
1272 if [ "$ret" != "0" ]; then
1273 echo "got clone command failed unexpectedly" >&2
1274 test_done "$testroot" "$ret"
1278 got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
1279 tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
1280 | tr -d ' ' | cut -d: -f2`
1282 cp -R $testroot/repo-clone $testroot/repo-clone2
1283 got tag -r $testroot/repo-clone2 -m '2.0' 2.0 >/dev/null
1284 tag_id2=`got ref -r $testroot/repo-clone2 -l | grep "^refs/tags/2.0" \
1285 | tr -d ' ' | cut -d: -f2`
1287 cat > $testroot/repo/.git/got.conf <<EOF
1292 repository "$testroot/repo-clone"
1295 repository "$testroot/repo-clone2"
1299 got ref -l -r $testroot/repo > $testroot/stdout
1300 if [ "$ret" != "0" ]; then
1301 echo "got ref command failed unexpectedly" >&2
1302 test_done "$testroot" "$ret"
1306 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1307 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1308 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1309 cmp -s $testroot/stdout $testroot/stdout.expected
1311 if [ "$ret" != "0" ]; then
1312 diff -u $testroot/stdout.expected $testroot/stdout
1313 test_done "$testroot" "$ret"
1317 # fetch tag 2.0 from repo-clone2
1318 got fetch -q -r $testroot/repo > $testroot/stdout
1320 if [ "$ret" != "0" ]; then
1321 echo "got fetch command failed unexpectedly" >&2
1322 test_done "$testroot" "$ret"
1326 got ref -l -r $testroot/repo > $testroot/stdout
1327 if [ "$ret" != "0" ]; then
1328 echo "got ref command failed unexpectedly" >&2
1329 test_done "$testroot" "$ret"
1333 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1334 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1335 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1336 >> $testroot/stdout.expected
1337 echo "refs/remotes/origin/master: $commit_id" \
1338 >> $testroot/stdout.expected
1339 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1340 echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
1341 cmp -s $testroot/stdout $testroot/stdout.expected
1343 if [ "$ret" != "0" ]; then
1344 diff -u $testroot/stdout.expected $testroot/stdout
1345 test_done "$testroot" "$ret"
1349 # send tag 1.0 to repo-clone
1350 got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
1352 if [ "$ret" != "0" ]; then
1353 echo "got send command failed unexpectedly" >&2
1354 test_done "$testroot" "$ret"
1358 got ref -l -r $testroot/repo-clone > $testroot/stdout
1359 if [ "$ret" != "0" ]; then
1360 echo "got ref command failed unexpectedly" >&2
1361 test_done "$testroot" "$ret"
1365 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1366 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1367 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1368 >> $testroot/stdout.expected
1369 echo "refs/remotes/origin/master: $commit_id" \
1370 >> $testroot/stdout.expected
1371 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1373 cmp -s $testroot/stdout $testroot/stdout.expected
1375 if [ "$ret" != "0" ]; then
1376 diff -u $testroot/stdout.expected $testroot/stdout
1377 test_done "$testroot" "$ret"
1381 git_fsck "$testroot" "$testroot/repo-clone"
1383 test_done "$testroot" "$ret"
1386 test_send_config() {
1387 local testroot=`test_init send_fetch_conf`
1388 local testurl=ssh://127.0.0.1/$testroot
1389 local commit_id=`git_show_head $testroot/repo`
1391 got clone -q $testurl/repo $testroot/repo-clone
1393 if [ "$ret" != "0" ]; then
1394 echo "got clone command failed unexpectedly" >&2
1395 test_done "$testroot" "$ret"
1399 cat > $testroot/repo/.git/got.conf <<EOF
1404 repository "$testroot/repo-clone"
1407 got ref -l -r $testroot/repo-clone > $testroot/stdout
1408 if [ "$ret" != "0" ]; then
1409 echo "got ref command failed unexpectedly" >&2
1410 test_done "$testroot" "$ret"
1414 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1415 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1416 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1417 >> $testroot/stdout.expected
1418 echo "refs/remotes/origin/master: $commit_id" \
1419 >> $testroot/stdout.expected
1421 cmp -s $testroot/stdout $testroot/stdout.expected
1423 if [ "$ret" != "0" ]; then
1424 diff -u $testroot/stdout.expected $testroot/stdout
1425 test_done "$testroot" "$ret"
1429 got branch -r $testroot/repo foo
1431 got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1433 if [ "$ret" != "0" ]; then
1434 echo "got send command failed unexpectedly" >&2
1435 test_done "$testroot" "$ret"
1439 got ref -l -r $testroot/repo-clone > $testroot/stdout
1440 if [ "$ret" != "0" ]; then
1441 echo "got ref command failed unexpectedly" >&2
1442 test_done "$testroot" "$ret"
1446 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1447 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1448 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1449 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1450 >> $testroot/stdout.expected
1451 echo "refs/remotes/origin/master: $commit_id" \
1452 >> $testroot/stdout.expected
1454 cmp -s $testroot/stdout $testroot/stdout.expected
1456 if [ "$ret" != "0" ]; then
1457 diff -u $testroot/stdout.expected $testroot/stdout
1458 test_done "$testroot" "$ret"
1462 git_fsck "$testroot" "$testroot/repo-clone"
1464 test_done "$testroot" "$ret"
1468 run_test test_send_basic
1469 run_test test_send_rebase_required
1470 run_test test_send_rebase_required_overwrite
1471 run_test test_send_delete
1472 run_test test_send_clone_and_send
1473 run_test test_send_tags
1474 run_test test_send_tag_of_deleted_branch
1475 run_test test_send_new_branch
1476 run_test test_send_all_branches
1477 run_test test_send_to_empty_repo
1478 run_test test_send_and_fetch_config
1479 run_test test_send_config