3 f8a36e22 2021-08-26 stsp # Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
5 f8a36e22 2021-08-26 stsp # Permission to use, copy, modify, and distribute this software for any
6 f8a36e22 2021-08-26 stsp # purpose with or without fee is hereby granted, provided that the above
7 f8a36e22 2021-08-26 stsp # copyright notice and this permission notice appear in all copies.
9 f8a36e22 2021-08-26 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 f8a36e22 2021-08-26 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 f8a36e22 2021-08-26 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 f8a36e22 2021-08-26 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 f8a36e22 2021-08-26 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 f8a36e22 2021-08-26 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 f8a36e22 2021-08-26 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 f8a36e22 2021-08-26 stsp . ./common.sh
19 f8a36e22 2021-08-26 stsp test_send_basic() {
20 f8a36e22 2021-08-26 stsp local testroot=`test_init send_basic`
21 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
22 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
24 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
26 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
27 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
28 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
31 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
32 f8a36e22 2021-08-26 stsp remote "origin" {
33 f8a36e22 2021-08-26 stsp protocol ssh
34 f8a36e22 2021-08-26 stsp server 127.0.0.1
35 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
38 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
39 f8a36e22 2021-08-26 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
40 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
42 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
43 3af9de88 2021-09-22 stsp (cd $testroot/repo && git rm -q beta)
44 3af9de88 2021-09-22 stsp (cd $testroot/repo && ln -s epsilon/zeta symlink && git add symlink)
45 3af9de88 2021-09-22 stsp echo "new file alpha" > $testroot/repo/new
46 3af9de88 2021-09-22 stsp (cd $testroot/repo && git add new)
47 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
48 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
50 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
52 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
53 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
54 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
58 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
59 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
61 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
62 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
63 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
67 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
68 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
69 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
70 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
74 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
75 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
76 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
77 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
78 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
80 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
82 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
83 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
84 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
88 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
89 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
90 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
91 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
95 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
96 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
97 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
98 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
99 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
100 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
102 3af9de88 2021-09-22 stsp cmp -s $testroot/stdout $testroot/stdout.expected
104 3af9de88 2021-09-22 stsp if [ "$ret" != "0" ]; then
105 3af9de88 2021-09-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
106 3af9de88 2021-09-22 stsp test_done "$testroot" "$ret"
110 3af9de88 2021-09-22 stsp got tree -r $testroot/repo-clone -c $commit_id2 -i -R \
111 3af9de88 2021-09-22 stsp > $testroot/stdout
112 3af9de88 2021-09-22 stsp got tree -r $testroot/repo -c $commit_id2 -i -R \
113 3af9de88 2021-09-22 stsp > $testroot/stdout.expected
114 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
116 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
117 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
118 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
122 f8a36e22 2021-08-26 stsp got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
124 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
125 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
126 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
130 f8a36e22 2021-08-26 stsp echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
131 f8a36e22 2021-08-26 stsp echo "Already up-to-date" >> $testroot/stdout.expected
132 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
134 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
135 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
136 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
140 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
142 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
145 f8a36e22 2021-08-26 stsp test_send_rebase_required() {
146 f8a36e22 2021-08-26 stsp local testroot=`test_init send_rebase_required`
147 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
148 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
150 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
152 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
153 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
154 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
157 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
158 f8a36e22 2021-08-26 stsp remote "origin" {
159 f8a36e22 2021-08-26 stsp protocol ssh
160 f8a36e22 2021-08-26 stsp server 127.0.0.1
161 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
164 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
165 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
166 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
168 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
169 f8a36e22 2021-08-26 stsp echo "modified alpha, too" > $testroot/wt-clone/alpha
170 f8a36e22 2021-08-26 stsp (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
172 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
174 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
175 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
176 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
180 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
181 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
183 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
184 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
185 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
189 f8a36e22 2021-08-26 stsp echo "got: refs/heads/master: fetch and rebase required" \
190 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
191 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
193 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
194 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
195 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
199 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
201 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
204 f8a36e22 2021-08-26 stsp test_send_rebase_required_overwrite() {
205 f8a36e22 2021-08-26 stsp local testroot=`test_init send_rebase_required_overwrite`
206 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
207 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
209 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
211 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
212 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
213 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
216 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
217 f8a36e22 2021-08-26 stsp remote "foobar" {
218 f8a36e22 2021-08-26 stsp protocol ssh
219 f8a36e22 2021-08-26 stsp server 127.0.0.1
220 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
223 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
224 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
225 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
227 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
228 f8a36e22 2021-08-26 stsp echo "modified alpha, too" > $testroot/wt-clone/alpha
229 f8a36e22 2021-08-26 stsp (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
230 f8a36e22 2021-08-26 stsp local commit_id3=`git_show_head $testroot/repo-clone`
232 f8a36e22 2021-08-26 stsp # non-default remote requires an explicit argument
233 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -f > $testroot/stdout \
234 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
236 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
237 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
238 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
241 f8a36e22 2021-08-26 stsp echo "got: origin: remote repository not found" \
242 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
243 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
245 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
246 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
247 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
251 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -f foobar > $testroot/stdout \
252 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
254 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
255 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
256 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
260 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
261 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
263 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
264 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
265 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
269 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
270 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
271 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
272 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
276 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
277 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
278 f8a36e22 2021-08-26 stsp echo "refs/remotes/foobar/master: $commit_id2" \
279 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
281 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
283 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
284 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
285 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
289 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
290 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
291 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
292 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
296 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt-clone && got info | grep 'UUID:' | \
297 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
298 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
299 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
300 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
301 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
302 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
303 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
304 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
305 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
307 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
309 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
310 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
311 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
315 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
317 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
320 f8a36e22 2021-08-26 stsp test_send_delete() {
321 f8a36e22 2021-08-26 stsp local testroot=`test_init send_delete`
322 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
323 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
325 f8a36e22 2021-08-26 stsp # branch1 exists in both repositories
326 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo branch1
328 f8a36e22 2021-08-26 stsp got clone -a -q $testurl/repo $testroot/repo-clone
330 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
331 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
332 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
335 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
336 f8a36e22 2021-08-26 stsp remote "origin" {
337 f8a36e22 2021-08-26 stsp protocol ssh
338 f8a36e22 2021-08-26 stsp server 127.0.0.1
339 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
342 f8a36e22 2021-08-26 stsp # branch2 exists only in the remote repository
343 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone branch2
345 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
346 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
347 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
348 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
352 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
353 f8a36e22 2021-08-26 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
354 f8a36e22 2021-08-26 stsp echo "refs/heads/branch2: $commit_id" >> $testroot/stdout.expected
355 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
357 f8a36e22 2021-08-26 stsp # Sending changes for a branch and deleting it at the same
358 f8a36e22 2021-08-26 stsp # time is not allowed.
359 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d branch1 -b branch1 \
360 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
362 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
363 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
364 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
367 f8a36e22 2021-08-26 stsp echo -n "got: changes on refs/heads/branch1 will be sent to server" \
368 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
369 f8a36e22 2021-08-26 stsp echo ": reference cannot be deleted" >> $testroot/stderr.expected
370 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
372 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
373 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
374 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
378 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/heads/branch1 origin \
379 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
381 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
382 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
383 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
387 1bd76734 2021-08-26 stsp got send -r $testroot/repo -d refs/heads/branch2 origin \
388 27b75514 2021-08-28 stsp > $testroot/stdout 2>$testroot/stderr
390 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
391 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
392 1bd76734 2021-08-26 stsp test_done "$testroot" "$ret"
396 1bd76734 2021-08-26 stsp echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
397 1bd76734 2021-08-26 stsp echo "Server has deleted refs/heads/branch2" \
398 1bd76734 2021-08-26 stsp >> $testroot/stdout.expected
400 1bd76734 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
402 1bd76734 2021-08-26 stsp if [ "$ret" != "0" ]; then
403 1bd76734 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
404 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
408 f8a36e22 2021-08-26 stsp # branchX exists in neither repository
409 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/heads/branchX origin \
410 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
412 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
413 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
414 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
417 f8a36e22 2021-08-26 stsp echo -n "got-send-pack: refs/heads/branchX does not exist in remote " \
418 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
419 f8a36e22 2021-08-26 stsp echo "repository: no such reference found" >> $testroot/stderr.expected
420 f8a36e22 2021-08-26 stsp echo "got: no such reference found" >> $testroot/stderr.expected
421 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
423 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
424 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
425 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
429 f8a36e22 2021-08-26 stsp # References outside of refs/heads/ cannot be deleted with 'got send'.
430 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/tags/1.0 origin \
431 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
433 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
434 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
435 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
438 f8a36e22 2021-08-26 stsp echo -n "got-send-pack: refs/heads/refs/tags/1.0 does not exist " \
439 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
440 f8a36e22 2021-08-26 stsp echo "in remote repository: no such reference found" \
441 f8a36e22 2021-08-26 stsp >> $testroot/stderr.expected
442 f8a36e22 2021-08-26 stsp echo "got: no such reference found" >> $testroot/stderr.expected
443 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
445 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
446 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
447 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
451 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
452 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
453 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
454 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
458 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
459 f8a36e22 2021-08-26 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
460 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
462 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
464 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
465 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
466 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
470 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
471 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
472 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
473 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
477 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
478 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
479 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
480 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
481 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/branch1: $commit_id" \
482 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
483 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
484 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
486 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
488 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
489 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
490 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
494 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
496 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
499 f8a36e22 2021-08-26 stsp test_send_clone_and_send() {
500 f8a36e22 2021-08-26 stsp local testroot=`test_init send_clone_and_send`
501 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
502 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
504 f8a36e22 2021-08-26 stsp (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
506 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
508 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
509 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
510 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
514 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt >/dev/null
515 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
516 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
517 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo-clone`
519 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
521 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
522 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
523 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
527 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
528 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
530 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
531 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
532 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
536 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
537 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
538 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
539 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
543 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
544 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
546 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
548 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
549 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
550 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
554 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
555 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
556 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
557 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
561 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
562 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
563 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
564 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
565 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
566 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
567 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
568 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
569 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
570 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
572 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
574 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
575 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
576 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
580 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
582 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
585 f8a36e22 2021-08-26 stsp test_send_tags() {
586 f8a36e22 2021-08-26 stsp local testroot=`test_init send_tags`
587 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
588 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
590 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
592 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
593 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
594 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
597 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
598 f8a36e22 2021-08-26 stsp remote "origin" {
599 f8a36e22 2021-08-26 stsp protocol ssh
600 f8a36e22 2021-08-26 stsp server 127.0.0.1
601 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
604 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
605 f8a36e22 2021-08-26 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
606 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
608 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
609 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
610 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
612 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '2.0' 2.0 >/dev/null
613 f8a36e22 2021-08-26 stsp tag_id2=`got ref -r $testroot/repo -l | grep "^refs/tags/2.0" \
614 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
616 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
618 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
619 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
620 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
624 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
625 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
627 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
628 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
629 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
633 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
634 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
635 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
636 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
640 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
641 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
642 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
643 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
644 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
645 f8a36e22 2021-08-26 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
647 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
649 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
650 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
651 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
655 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
656 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
657 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
658 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
662 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
663 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
664 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
665 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
666 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
667 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
668 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
669 f8a36e22 2021-08-26 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
671 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
673 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
674 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
675 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
679 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
680 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
681 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
682 92410079 2021-10-16 stsp cmp -s $testroot/stdout $testroot/stdout.expected
684 92410079 2021-10-16 stsp if [ "$ret" != "0" ]; then
685 92410079 2021-10-16 stsp diff -u $testroot/stdout.expected $testroot/stdout
686 92410079 2021-10-16 stsp test_done "$testroot" "$ret"
690 92410079 2021-10-16 stsp # Send the same tags again. This should be a no-op.
691 92410079 2021-10-16 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
693 92410079 2021-10-16 stsp if [ "$ret" != "0" ]; then
694 92410079 2021-10-16 stsp echo "got send command failed unexpectedly" >&2
695 92410079 2021-10-16 stsp test_done "$testroot" "$ret"
699 92410079 2021-10-16 stsp echo -n > $testroot/stdout.expected
700 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
702 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
703 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
704 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
708 f8a36e22 2021-08-26 stsp # Overwriting an existing tag 'got send -f'.
709 f8a36e22 2021-08-26 stsp got ref -r $testroot/repo -d refs/tags/1.0 >/dev/null
710 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
711 f8a36e22 2021-08-26 stsp tag_id3=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
712 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
714 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -t 1.0 > $testroot/stdout \
715 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
717 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
718 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
719 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
723 f8a36e22 2021-08-26 stsp echo "got: refs/tags/1.0: tag already exists on server" \
724 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
725 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
727 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
728 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
729 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
733 f8a36e22 2021-08-26 stsp # attempting the same with -T should fail, too
734 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -T > $testroot/stdout \
735 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
737 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
738 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
739 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
743 f8a36e22 2021-08-26 stsp echo "got: refs/tags/1.0: tag already exists on server" \
744 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
745 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
747 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
748 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
749 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
753 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
754 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
755 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
756 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
758 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
759 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
760 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
764 f8a36e22 2021-08-26 stsp # overwrite the 1.0 tag only
765 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -t 1.0 -f > $testroot/stdout \
766 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
768 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
769 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
770 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
774 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
775 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id3" > $testroot/stdout.expected
776 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
777 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
779 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
780 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
781 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
785 c2105d00 2021-09-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
786 c2105d00 2021-09-14 stsp echo 'new line in file alpha' >> $testroot/wt/alpha
787 c2105d00 2021-09-14 stsp (cd $testroot/wt && got commit -m 'changing file alpha' > /dev/null)
789 c2105d00 2021-09-14 stsp # Send the new commit in isolation.
790 c2105d00 2021-09-14 stsp got send -q -r $testroot/repo > $testroot/stdout \
791 c2105d00 2021-09-14 stsp 2> $testroot/stderr
793 c2105d00 2021-09-14 stsp if [ "$ret" != "0" ]; then
794 c2105d00 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
795 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
799 c2105d00 2021-09-14 stsp # Now tag it and send the tag.
800 c2105d00 2021-09-14 stsp # Verify that just the new tag object gets sent.
801 c2105d00 2021-09-14 stsp got tag -r $testroot/repo -m '3.0' 3.0 >/dev/null
802 c2105d00 2021-09-14 stsp tag_id4=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
803 c2105d00 2021-09-14 stsp | tr -d ' ' | cut -d: -f2`
805 c2105d00 2021-09-14 stsp got send -r $testroot/repo -t 3.0 > $testroot/stdout.raw \
806 c2105d00 2021-09-14 stsp 2> $testroot/stderr
808 c2105d00 2021-09-14 stsp if [ "$ret" != "0" ]; then
809 c2105d00 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
810 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
813 c2105d00 2021-09-14 stsp tr -d '\r' < $testroot/stdout.raw > $testroot/stdout
814 c2105d00 2021-09-14 stsp if ! grep -q "packing 2 references; 1 object; deltify: 100%" \
815 c2105d00 2021-09-14 stsp $testroot/stdout; then
816 c2105d00 2021-09-14 stsp echo "got send did apparently pack too many objects:" >&2
817 c2105d00 2021-09-14 stsp cat $testroot/stdout.raw >&2
818 c2105d00 2021-09-14 stsp test_done "$testroot" "1"
822 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
824 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
827 26960ff7 2021-09-14 stsp test_send_tag_of_deleted_branch() {
828 26960ff7 2021-09-14 stsp local testroot=`test_init send_tag_of_deleted_branch`
829 26960ff7 2021-09-14 stsp local testurl=ssh://127.0.0.1/$testroot
830 26960ff7 2021-09-14 stsp local commit_id=`git_show_head $testroot/repo`
832 26960ff7 2021-09-14 stsp got clone -q $testurl/repo $testroot/repo-clone
834 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
835 26960ff7 2021-09-14 stsp echo "got clone command failed unexpectedly" >&2
836 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
839 26960ff7 2021-09-14 stsp cat > $testroot/repo/.git/got.conf <<EOF
840 26960ff7 2021-09-14 stsp remote "origin" {
841 26960ff7 2021-09-14 stsp protocol ssh
842 26960ff7 2021-09-14 stsp server 127.0.0.1
843 26960ff7 2021-09-14 stsp repository "$testroot/repo-clone"
846 26960ff7 2021-09-14 stsp got branch -r $testroot/repo foo
848 26960ff7 2021-09-14 stsp # modify alpha on branch foo
849 26960ff7 2021-09-14 stsp got checkout -b foo $testroot/repo $testroot/wt > /dev/null
850 26960ff7 2021-09-14 stsp echo boo >> $testroot/wt/beta
851 26960ff7 2021-09-14 stsp (cd $testroot/wt && got commit -m 'changed beta on branch foo' \
852 26960ff7 2021-09-14 stsp > /dev/null)
853 26960ff7 2021-09-14 stsp local commit_id2=`git_show_branch_head $testroot/repo foo`
855 26960ff7 2021-09-14 stsp # tag HEAD commit of branch foo
856 26960ff7 2021-09-14 stsp got tag -r $testroot/repo -c foo -m '1.0' 1.0 > /dev/null
857 26960ff7 2021-09-14 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
858 26960ff7 2021-09-14 stsp | tr -d ' ' | cut -d: -f2`
860 26960ff7 2021-09-14 stsp # delete the branch; commit is now only reachable via tags/1.0
861 26960ff7 2021-09-14 stsp got branch -r $testroot/repo -d foo > /dev/null
863 26960ff7 2021-09-14 stsp # unrelated change on master branch, then try sending this branch
864 26960ff7 2021-09-14 stsp # and the tag
865 26960ff7 2021-09-14 stsp echo "modified alpha" > $testroot/repo/alpha
866 26960ff7 2021-09-14 stsp git_commit $testroot/repo -m "modified alpha"
867 26960ff7 2021-09-14 stsp local commit_id3=`git_show_head $testroot/repo`
869 26960ff7 2021-09-14 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
871 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
872 26960ff7 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
873 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
877 26960ff7 2021-09-14 stsp echo -n > $testroot/stdout.expected
878 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
880 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
881 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
882 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
886 26960ff7 2021-09-14 stsp got ref -l -r $testroot/repo > $testroot/stdout
887 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
888 26960ff7 2021-09-14 stsp echo "got ref command failed unexpectedly" >&2
889 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
893 26960ff7 2021-09-14 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
894 26960ff7 2021-09-14 stsp cut -d ':' -f 2 | tr -d ' ')`
895 26960ff7 2021-09-14 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
896 26960ff7 2021-09-14 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
897 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
898 26960ff7 2021-09-14 stsp echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
899 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/master: $commit_id3" \
900 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
901 26960ff7 2021-09-14 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
903 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
905 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
906 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
907 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
911 26960ff7 2021-09-14 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
912 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
913 26960ff7 2021-09-14 stsp echo "got ref command failed unexpectedly" >&2
914 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
918 26960ff7 2021-09-14 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
919 26960ff7 2021-09-14 stsp echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
920 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
921 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
922 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/master: $commit_id" \
923 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
924 26960ff7 2021-09-14 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
926 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
928 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
929 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
930 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
934 26960ff7 2021-09-14 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
935 26960ff7 2021-09-14 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
937 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
939 26960ff7 2021-09-14 stsp if [ "$ret" != "0" ]; then
940 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
941 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
945 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
947 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
950 f8a36e22 2021-08-26 stsp test_send_new_branch() {
951 f8a36e22 2021-08-26 stsp local testroot=`test_init send_new_branch`
952 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
953 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
955 f8a36e22 2021-08-26 stsp (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
957 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
959 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
960 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
961 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
965 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone foo >/dev/null
966 f8a36e22 2021-08-26 stsp got checkout -b foo $testroot/repo-clone $testroot/wt >/dev/null
967 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
968 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
969 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_branch_head $testroot/repo-clone foo`
971 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
973 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
974 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
975 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
979 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
980 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
982 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
983 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
984 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
988 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
989 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
990 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
991 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
995 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
996 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
997 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
999 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1001 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1002 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1003 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1007 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1008 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1009 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1010 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1014 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1015 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
1016 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1017 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1018 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1019 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
1020 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1021 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1022 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1023 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/foo: $commit_id2" \
1024 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1025 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1026 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1028 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1030 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1031 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1032 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1036 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1038 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1041 f8a36e22 2021-08-26 stsp test_send_all_branches() {
1042 f8a36e22 2021-08-26 stsp local testroot=`test_init send_all_branches`
1043 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
1044 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
1046 f8a36e22 2021-08-26 stsp (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
1048 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1050 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1051 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
1052 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1056 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt >/dev/null
1057 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
1058 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
1059 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo-clone`
1061 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone foo >/dev/null
1062 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got update -b foo >/dev/null)
1063 f8a36e22 2021-08-26 stsp echo "modified beta on new branch foo" > $testroot/wt/beta
1064 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1065 f8a36e22 2021-08-26 stsp local commit_id3=`git_show_branch_head $testroot/repo-clone foo`
1067 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone bar >/dev/null
1068 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got update -b bar >/dev/null)
1069 f8a36e22 2021-08-26 stsp echo "modified beta again on new branch bar" > $testroot/wt/beta
1070 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1071 f8a36e22 2021-08-26 stsp local commit_id4=`git_show_branch_head $testroot/repo-clone bar`
1073 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1074 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1075 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1076 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1080 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1081 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1082 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1083 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1085 f8a36e22 2021-08-26 stsp got send -a -q -r $testroot/repo-clone -b master > $testroot/stdout \
1086 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
1088 f9756a57 2021-08-26 stsp if [ "$ret" = "0" ]; then
1089 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
1090 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1093 f8a36e22 2021-08-26 stsp echo "got: -a and -b options are mutually exclusive" \
1094 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
1095 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1097 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1098 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
1099 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1103 f8a36e22 2021-08-26 stsp got send -a -q -r $testroot/repo-clone > $testroot/stdout \
1104 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
1106 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1107 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1108 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1112 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
1113 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1115 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1116 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1117 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1121 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
1122 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1123 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1124 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1128 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1129 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1130 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1131 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1133 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1135 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1136 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1137 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1141 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1142 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1143 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1144 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1148 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1149 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
1150 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1151 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id4" \
1152 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1153 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1154 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1155 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1156 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1157 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1158 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/bar: $commit_id4" \
1159 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1160 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/foo: $commit_id3" \
1161 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1162 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
1163 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1165 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1167 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1168 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1169 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1173 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1175 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1178 f8a36e22 2021-08-26 stsp test_send_to_empty_repo() {
1179 f8a36e22 2021-08-26 stsp local testroot=`test_init send_to_empty_repo`
1180 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
1181 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
1183 f8a36e22 2021-08-26 stsp got init $testroot/repo2
1186 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1187 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
1188 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1191 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
1192 f8a36e22 2021-08-26 stsp remote "origin" {
1193 f8a36e22 2021-08-26 stsp protocol ssh
1194 f8a36e22 2021-08-26 stsp server 127.0.0.1
1195 f8a36e22 2021-08-26 stsp repository "$testroot/repo2"
1198 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
1199 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
1200 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
1202 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1204 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1205 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1206 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1210 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
1211 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1213 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1214 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1215 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1219 f8a36e22 2021-08-26 stsp # XXX Workaround: We cannot give the target for HEAD to 'got init'
1220 f8a36e22 2021-08-26 stsp got ref -r $testroot/repo2 -s refs/heads/master HEAD
1222 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
1223 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1224 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1225 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1229 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1230 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1231 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
1232 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1234 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1236 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1237 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1238 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1242 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo2 > $testroot/stdout
1243 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1244 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1245 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1249 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1250 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1252 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1254 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1255 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1256 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1260 f8a36e22 2021-08-26 stsp got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1262 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1263 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1264 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1268 f8a36e22 2021-08-26 stsp echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
1269 f8a36e22 2021-08-26 stsp echo "Already up-to-date" >> $testroot/stdout.expected
1270 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1272 f8a36e22 2021-08-26 stsp if [ "$ret" != "0" ]; then
1273 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1274 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1278 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo2"
1280 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1283 6480c871 2021-08-30 stsp test_send_and_fetch_config() {
1284 6480c871 2021-08-30 stsp local testroot=`test_init send_fetch_conf`
1285 6480c871 2021-08-30 stsp local testurl=ssh://127.0.0.1/$testroot
1286 6480c871 2021-08-30 stsp local commit_id=`git_show_head $testroot/repo`
1288 6480c871 2021-08-30 stsp got clone -q $testurl/repo $testroot/repo-clone
1290 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1291 6480c871 2021-08-30 stsp echo "got clone command failed unexpectedly" >&2
1292 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1296 6480c871 2021-08-30 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
1297 6480c871 2021-08-30 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
1298 6480c871 2021-08-30 stsp | tr -d ' ' | cut -d: -f2`
1300 6480c871 2021-08-30 stsp cp -R $testroot/repo-clone $testroot/repo-clone2
1301 6480c871 2021-08-30 stsp got tag -r $testroot/repo-clone2 -m '2.0' 2.0 >/dev/null
1302 6480c871 2021-08-30 stsp tag_id2=`got ref -r $testroot/repo-clone2 -l | grep "^refs/tags/2.0" \
1303 6480c871 2021-08-30 stsp | tr -d ' ' | cut -d: -f2`
1305 6480c871 2021-08-30 stsp cat > $testroot/repo/.git/got.conf <<EOF
1306 6480c871 2021-08-30 stsp remote "origin" {
1307 6480c871 2021-08-30 stsp protocol ssh
1308 6480c871 2021-08-30 stsp server 127.0.0.1
1310 6480c871 2021-08-30 stsp repository "$testroot/repo-clone"
1313 6480c871 2021-08-30 stsp repository "$testroot/repo-clone2"
1317 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo > $testroot/stdout
1318 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1319 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1320 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1324 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1325 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1326 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1327 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1329 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1330 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1331 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1335 6480c871 2021-08-30 stsp # fetch tag 2.0 from repo-clone2
1336 6480c871 2021-08-30 stsp got fetch -q -r $testroot/repo > $testroot/stdout
1338 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1339 6480c871 2021-08-30 stsp echo "got fetch command failed unexpectedly" >&2
1340 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1344 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo > $testroot/stdout
1345 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1346 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1347 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1351 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1352 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1353 6480c871 2021-08-30 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1354 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1355 6480c871 2021-08-30 stsp echo "refs/remotes/origin/master: $commit_id" \
1356 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1357 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1358 6480c871 2021-08-30 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
1359 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1361 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1362 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1363 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1367 6480c871 2021-08-30 stsp # send tag 1.0 to repo-clone
1368 6480c871 2021-08-30 stsp got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
1370 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1371 6480c871 2021-08-30 stsp echo "got send command failed unexpectedly" >&2
1372 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1376 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1377 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1378 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1379 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1383 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1384 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1385 6480c871 2021-08-30 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1386 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1387 6480c871 2021-08-30 stsp echo "refs/remotes/origin/master: $commit_id" \
1388 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1389 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1391 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1393 6480c871 2021-08-30 stsp if [ "$ret" != "0" ]; then
1394 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1395 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1399 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1401 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1404 eac1df47 2021-09-01 stsp test_send_config() {
1405 eac1df47 2021-09-01 stsp local testroot=`test_init send_fetch_conf`
1406 eac1df47 2021-09-01 stsp local testurl=ssh://127.0.0.1/$testroot
1407 eac1df47 2021-09-01 stsp local commit_id=`git_show_head $testroot/repo`
1409 eac1df47 2021-09-01 stsp got clone -q $testurl/repo $testroot/repo-clone
1411 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1412 eac1df47 2021-09-01 stsp echo "got clone command failed unexpectedly" >&2
1413 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1417 eac1df47 2021-09-01 stsp cat > $testroot/repo/.git/got.conf <<EOF
1418 eac1df47 2021-09-01 stsp remote "origin" {
1419 eac1df47 2021-09-01 stsp protocol ssh
1420 eac1df47 2021-09-01 stsp server 127.0.0.1
1421 eac1df47 2021-09-01 stsp branch foo
1422 eac1df47 2021-09-01 stsp repository "$testroot/repo-clone"
1425 eac1df47 2021-09-01 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1426 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1427 eac1df47 2021-09-01 stsp echo "got ref command failed unexpectedly" >&2
1428 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1432 eac1df47 2021-09-01 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1433 eac1df47 2021-09-01 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1434 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1435 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1436 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/master: $commit_id" \
1437 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1439 eac1df47 2021-09-01 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1441 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1442 eac1df47 2021-09-01 stsp diff -u $testroot/stdout.expected $testroot/stdout
1443 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1447 eac1df47 2021-09-01 stsp got branch -r $testroot/repo foo
1449 eac1df47 2021-09-01 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1451 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1452 eac1df47 2021-09-01 stsp echo "got send command failed unexpectedly" >&2
1453 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1457 eac1df47 2021-09-01 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1458 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1459 eac1df47 2021-09-01 stsp echo "got ref command failed unexpectedly" >&2
1460 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1464 eac1df47 2021-09-01 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1465 eac1df47 2021-09-01 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1466 eac1df47 2021-09-01 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1467 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1468 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1469 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/master: $commit_id" \
1470 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1472 eac1df47 2021-09-01 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1474 eac1df47 2021-09-01 stsp if [ "$ret" != "0" ]; then
1475 eac1df47 2021-09-01 stsp diff -u $testroot/stdout.expected $testroot/stdout
1476 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1480 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1482 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1485 f8a36e22 2021-08-26 stsp test_parseargs "$@"
1486 f8a36e22 2021-08-26 stsp run_test test_send_basic
1487 f8a36e22 2021-08-26 stsp run_test test_send_rebase_required
1488 f8a36e22 2021-08-26 stsp run_test test_send_rebase_required_overwrite
1489 f8a36e22 2021-08-26 stsp run_test test_send_delete
1490 f8a36e22 2021-08-26 stsp run_test test_send_clone_and_send
1491 f8a36e22 2021-08-26 stsp run_test test_send_tags
1492 26960ff7 2021-09-14 stsp run_test test_send_tag_of_deleted_branch
1493 f8a36e22 2021-08-26 stsp run_test test_send_new_branch
1494 f8a36e22 2021-08-26 stsp run_test test_send_all_branches
1495 f8a36e22 2021-08-26 stsp run_test test_send_to_empty_repo
1496 6480c871 2021-08-30 stsp run_test test_send_and_fetch_config
1497 eac1df47 2021-09-01 stsp run_test test_send_config