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 49c543a6 2022-03-31 naddy if [ $ret -ne 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 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
44 f73bf5bd 2023-10-01 naddy (cd $testroot/repo && ln -s epsilon/zeta symlink)
45 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add symlink
46 3af9de88 2021-09-22 stsp echo "new file alpha" > $testroot/repo/new
47 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add new
48 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
49 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
51 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
53 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
54 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
55 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
59 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
60 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
62 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
63 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
64 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
68 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
70 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
71 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
72 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
76 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
77 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
78 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
79 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
80 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
82 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
84 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
85 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
86 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
90 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
92 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
93 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
94 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
98 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
99 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
100 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
101 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
102 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
103 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
105 3af9de88 2021-09-22 stsp cmp -s $testroot/stdout $testroot/stdout.expected
107 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
108 3af9de88 2021-09-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
109 3af9de88 2021-09-22 stsp test_done "$testroot" "$ret"
113 3af9de88 2021-09-22 stsp got tree -r $testroot/repo-clone -c $commit_id2 -i -R \
114 3af9de88 2021-09-22 stsp > $testroot/stdout
115 3af9de88 2021-09-22 stsp got tree -r $testroot/repo -c $commit_id2 -i -R \
116 3af9de88 2021-09-22 stsp > $testroot/stdout.expected
117 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
119 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
120 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
121 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
125 f8a36e22 2021-08-26 stsp got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
127 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
128 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
129 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
133 0deb9607 2022-11-18 op echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo-clone" \
134 0deb9607 2022-11-18 op > $testroot/stdout.expected
135 f8a36e22 2021-08-26 stsp echo "Already up-to-date" >> $testroot/stdout.expected
136 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
138 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
139 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
140 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
144 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
146 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
149 f8a36e22 2021-08-26 stsp test_send_rebase_required() {
150 f8a36e22 2021-08-26 stsp local testroot=`test_init send_rebase_required`
151 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
152 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
154 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
156 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
157 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
158 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
161 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
162 f8a36e22 2021-08-26 stsp remote "origin" {
163 f8a36e22 2021-08-26 stsp protocol ssh
164 f8a36e22 2021-08-26 stsp server 127.0.0.1
165 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
168 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
169 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
170 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
172 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
173 f8a36e22 2021-08-26 stsp echo "modified alpha, too" > $testroot/wt-clone/alpha
174 f8a36e22 2021-08-26 stsp (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
176 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
178 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
179 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
180 a19f439c 2022-06-03 op test_done "$testroot" 1
184 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
185 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
187 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
188 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
189 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
193 f8a36e22 2021-08-26 stsp echo "got: refs/heads/master: fetch and rebase required" \
194 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
195 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
197 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
198 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
199 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
203 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
205 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
208 f8a36e22 2021-08-26 stsp test_send_rebase_required_overwrite() {
209 f8a36e22 2021-08-26 stsp local testroot=`test_init send_rebase_required_overwrite`
210 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
211 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
213 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
215 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
216 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
217 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
220 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
221 f8a36e22 2021-08-26 stsp remote "foobar" {
222 f8a36e22 2021-08-26 stsp protocol ssh
223 f8a36e22 2021-08-26 stsp server 127.0.0.1
224 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
227 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
228 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
229 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
231 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt-clone >/dev/null
232 f8a36e22 2021-08-26 stsp echo "modified alpha, too" > $testroot/wt-clone/alpha
233 f8a36e22 2021-08-26 stsp (cd $testroot/wt-clone && got commit -m 'change alpha' >/dev/null)
234 f8a36e22 2021-08-26 stsp local commit_id3=`git_show_head $testroot/repo-clone`
236 f8a36e22 2021-08-26 stsp # non-default remote requires an explicit argument
237 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -f > $testroot/stdout \
238 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
240 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
241 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
242 a19f439c 2022-06-03 op test_done "$testroot" 1
245 f8a36e22 2021-08-26 stsp echo "got: origin: remote repository not found" \
246 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
247 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
249 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
250 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
251 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
255 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -f foobar > $testroot/stdout \
256 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
258 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
259 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
260 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
264 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
265 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
267 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
268 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
269 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
273 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
275 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
276 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
277 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
281 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
282 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
283 f8a36e22 2021-08-26 stsp echo "refs/remotes/foobar/master: $commit_id2" \
284 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
286 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
288 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
289 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
290 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
294 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
296 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
297 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
298 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
302 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt-clone && got info | grep 'UUID:' | \
303 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
304 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
305 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
306 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
307 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
308 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
309 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
310 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
311 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
313 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
315 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
316 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
317 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
321 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
323 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
326 e166551f 2023-04-17 stsp test_send_merge_commit() {
327 e166551f 2023-04-17 stsp local testroot=`test_init send_merge_commit`
328 e166551f 2023-04-17 stsp local testurl=ssh://127.0.0.1/$testroot
330 e166551f 2023-04-17 stsp if ! got clone -q "$testurl/repo" "$testroot/repo-clone"; then
331 e166551f 2023-04-17 stsp echo "got clone command failed unexpectedly" >&2
332 e166551f 2023-04-17 stsp test_done "$testroot" 1
336 e166551f 2023-04-17 stsp echo 'upstream change' > $testroot/repo/alpha
337 e166551f 2023-04-17 stsp git_commit $testroot/repo -m 'upstream change'
339 e166551f 2023-04-17 stsp got checkout $testroot/repo-clone $testroot/wt-clone > /dev/null
340 e166551f 2023-04-17 stsp echo 'downstream change' > $testroot/wt-clone/beta
341 e166551f 2023-04-17 stsp (cd $testroot/wt-clone && got commit -m 'downstream change' > /dev/null)
343 e166551f 2023-04-17 stsp got fetch -q -r $testroot/repo-clone
344 e166551f 2023-04-17 stsp (cd $testroot/wt-clone && got update > /dev/null)
345 e166551f 2023-04-17 stsp (cd $testroot/wt-clone && got merge origin/master > /dev/null)
347 e166551f 2023-04-17 stsp if [ $ret -ne 0 ]; then
348 e166551f 2023-04-17 stsp echo "got merge command failed unexpectedly" >&2
349 e166551f 2023-04-17 stsp test_done "$testroot" "$ret"
353 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config receive.denyCurrentBranch ignore
355 e166551f 2023-04-17 stsp got send -q -r $testroot/repo-clone
357 e166551f 2023-04-17 stsp if [ $ret -ne 0 ]; then
358 e166551f 2023-04-17 stsp test_done "$testroot" "$ret"
362 e166551f 2023-04-17 stsp test_done "$testroot" 0
365 f8a36e22 2021-08-26 stsp test_send_delete() {
366 f8a36e22 2021-08-26 stsp local testroot=`test_init send_delete`
367 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
368 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
370 f8a36e22 2021-08-26 stsp # branch1 exists in both repositories
371 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo branch1
373 f8a36e22 2021-08-26 stsp got clone -a -q $testurl/repo $testroot/repo-clone
375 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
376 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
377 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
380 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
381 f8a36e22 2021-08-26 stsp remote "origin" {
382 f8a36e22 2021-08-26 stsp protocol ssh
383 f8a36e22 2021-08-26 stsp server 127.0.0.1
384 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
387 f8a36e22 2021-08-26 stsp # branch2 exists only in the remote repository
388 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone branch2
390 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
392 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
393 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
394 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
398 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
399 f8a36e22 2021-08-26 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
400 f8a36e22 2021-08-26 stsp echo "refs/heads/branch2: $commit_id" >> $testroot/stdout.expected
401 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
403 f8a36e22 2021-08-26 stsp # Sending changes for a branch and deleting it at the same
404 f8a36e22 2021-08-26 stsp # time is not allowed.
405 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d branch1 -b branch1 \
406 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
408 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
409 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
410 a19f439c 2022-06-03 op test_done "$testroot" 1
413 f8a36e22 2021-08-26 stsp echo -n "got: changes on refs/heads/branch1 will be sent to server" \
414 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
415 f8a36e22 2021-08-26 stsp echo ": reference cannot be deleted" >> $testroot/stderr.expected
416 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
418 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
419 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
420 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
424 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/heads/branch1 origin \
425 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
427 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
428 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
429 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
433 1bd76734 2021-08-26 stsp got send -r $testroot/repo -d refs/heads/branch2 origin \
434 27b75514 2021-08-28 stsp > $testroot/stdout 2>$testroot/stderr
436 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
437 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
438 1bd76734 2021-08-26 stsp test_done "$testroot" "$ret"
442 0deb9607 2022-11-18 op echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo-clone" \
443 0deb9607 2022-11-18 op > $testroot/stdout.expected
444 1bd76734 2021-08-26 stsp echo "Server has deleted refs/heads/branch2" \
445 1bd76734 2021-08-26 stsp >> $testroot/stdout.expected
447 1bd76734 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
449 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
450 1bd76734 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
451 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
455 f8a36e22 2021-08-26 stsp # branchX exists in neither repository
456 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/heads/branchX origin \
457 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
459 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
460 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
461 a19f439c 2022-06-03 op test_done "$testroot" 1
464 f8a36e22 2021-08-26 stsp echo -n "got-send-pack: refs/heads/branchX does not exist in remote " \
465 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
466 f8a36e22 2021-08-26 stsp echo "repository: no such reference found" >> $testroot/stderr.expected
467 f8a36e22 2021-08-26 stsp echo "got: no such reference found" >> $testroot/stderr.expected
468 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
470 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
471 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
472 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
476 f8a36e22 2021-08-26 stsp # References outside of refs/heads/ cannot be deleted with 'got send'.
477 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -d refs/tags/1.0 origin \
478 f8a36e22 2021-08-26 stsp > $testroot/stdout 2> $testroot/stderr
480 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
481 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
482 a19f439c 2022-06-03 op test_done "$testroot" 1
485 f8a36e22 2021-08-26 stsp echo -n "got-send-pack: refs/heads/refs/tags/1.0 does not exist " \
486 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
487 f8a36e22 2021-08-26 stsp echo "in remote repository: no such reference found" \
488 f8a36e22 2021-08-26 stsp >> $testroot/stderr.expected
489 f8a36e22 2021-08-26 stsp echo "got: no such reference found" >> $testroot/stderr.expected
490 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
492 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
493 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
494 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
498 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
500 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
501 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
502 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
506 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
507 f8a36e22 2021-08-26 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
508 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
510 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
513 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
514 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
518 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
520 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
521 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
522 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
526 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
527 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
528 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
529 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
530 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/branch1: $commit_id" \
531 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
532 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
533 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
535 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
537 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
538 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
539 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
543 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
545 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
548 f8a36e22 2021-08-26 stsp test_send_clone_and_send() {
549 f8a36e22 2021-08-26 stsp local testroot=`test_init send_clone_and_send`
550 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
551 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
553 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config receive.denyCurrentBranch ignore
555 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
557 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
558 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
559 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
563 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt >/dev/null
564 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
565 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
566 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo-clone`
568 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
570 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
571 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
572 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
576 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
577 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
579 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
580 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
581 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
585 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
587 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
588 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
589 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
593 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
594 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
596 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
598 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
599 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
600 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
604 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
606 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
607 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
608 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
612 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
613 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
614 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
615 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
616 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
617 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
618 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
619 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
620 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
621 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
623 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
625 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
626 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
627 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
631 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
633 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
636 f8a36e22 2021-08-26 stsp test_send_tags() {
637 f8a36e22 2021-08-26 stsp local testroot=`test_init send_tags`
638 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
639 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
641 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
643 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
644 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
645 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
648 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
649 f8a36e22 2021-08-26 stsp remote "origin" {
650 f8a36e22 2021-08-26 stsp protocol ssh
651 f8a36e22 2021-08-26 stsp server 127.0.0.1
652 f8a36e22 2021-08-26 stsp repository "$testroot/repo-clone"
655 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
656 f8a36e22 2021-08-26 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
657 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
659 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
660 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
661 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
663 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '2.0' 2.0 >/dev/null
664 f8a36e22 2021-08-26 stsp tag_id2=`got ref -r $testroot/repo -l | grep "^refs/tags/2.0" \
665 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
667 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
669 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
670 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
671 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
675 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
676 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
678 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
679 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
680 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
684 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
686 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
687 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
688 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
692 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
693 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
694 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
695 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
696 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
697 f8a36e22 2021-08-26 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
699 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
701 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
702 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
703 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
707 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
709 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
710 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
711 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
715 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
716 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
717 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
718 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
719 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
720 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
721 f8a36e22 2021-08-26 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
722 f8a36e22 2021-08-26 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
724 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
726 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
727 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
728 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
732 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
733 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
734 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
735 92410079 2021-10-16 stsp cmp -s $testroot/stdout $testroot/stdout.expected
737 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
738 92410079 2021-10-16 stsp diff -u $testroot/stdout.expected $testroot/stdout
739 92410079 2021-10-16 stsp test_done "$testroot" "$ret"
743 92410079 2021-10-16 stsp # Send the same tags again. This should be a no-op.
744 92410079 2021-10-16 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
746 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
747 92410079 2021-10-16 stsp echo "got send command failed unexpectedly" >&2
748 92410079 2021-10-16 stsp test_done "$testroot" "$ret"
752 92410079 2021-10-16 stsp echo -n > $testroot/stdout.expected
753 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
755 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
756 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
757 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
761 f8a36e22 2021-08-26 stsp # Overwriting an existing tag 'got send -f'.
762 f8a36e22 2021-08-26 stsp got ref -r $testroot/repo -d refs/tags/1.0 >/dev/null
763 f8a36e22 2021-08-26 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
764 f8a36e22 2021-08-26 stsp tag_id3=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
765 f8a36e22 2021-08-26 stsp | tr -d ' ' | cut -d: -f2`
767 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -t 1.0 > $testroot/stdout \
768 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
770 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
771 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
772 a19f439c 2022-06-03 op test_done "$testroot" 1
776 f8a36e22 2021-08-26 stsp echo "got: refs/tags/1.0: tag already exists on server" \
777 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
778 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
780 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
781 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
782 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
786 f8a36e22 2021-08-26 stsp # attempting the same with -T should fail, too
787 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -T > $testroot/stdout \
788 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
790 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
791 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
792 a19f439c 2022-06-03 op test_done "$testroot" 1
796 f8a36e22 2021-08-26 stsp echo "got: refs/tags/1.0: tag already exists on server" \
797 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
798 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
800 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
801 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
802 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
806 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
807 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
808 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
809 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
811 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
812 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
813 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
817 f8a36e22 2021-08-26 stsp # overwrite the 1.0 tag only
818 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo -t 1.0 -f > $testroot/stdout \
819 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
821 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
822 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
823 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
827 f8a36e22 2021-08-26 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
828 f8a36e22 2021-08-26 stsp echo "tag 1.0 $tag_id3" > $testroot/stdout.expected
829 f8a36e22 2021-08-26 stsp echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
830 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
832 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
833 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
834 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
838 c2105d00 2021-09-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
839 c2105d00 2021-09-14 stsp echo 'new line in file alpha' >> $testroot/wt/alpha
840 c2105d00 2021-09-14 stsp (cd $testroot/wt && got commit -m 'changing file alpha' > /dev/null)
842 c2105d00 2021-09-14 stsp # Send the new commit in isolation.
843 c2105d00 2021-09-14 stsp got send -q -r $testroot/repo > $testroot/stdout \
844 c2105d00 2021-09-14 stsp 2> $testroot/stderr
846 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
847 c2105d00 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
848 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
852 c2105d00 2021-09-14 stsp # Now tag it and send the tag.
853 c2105d00 2021-09-14 stsp # Verify that just the new tag object gets sent.
854 c2105d00 2021-09-14 stsp got tag -r $testroot/repo -m '3.0' 3.0 >/dev/null
855 c2105d00 2021-09-14 stsp tag_id4=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
856 c2105d00 2021-09-14 stsp | tr -d ' ' | cut -d: -f2`
858 c2105d00 2021-09-14 stsp got send -r $testroot/repo -t 3.0 > $testroot/stdout.raw \
859 c2105d00 2021-09-14 stsp 2> $testroot/stderr
861 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
862 c2105d00 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
863 c2105d00 2021-09-14 stsp test_done "$testroot" "$ret"
866 c2105d00 2021-09-14 stsp tr -d '\r' < $testroot/stdout.raw > $testroot/stdout
867 c2105d00 2021-09-14 stsp if ! grep -q "packing 2 references; 1 object; deltify: 100%" \
868 c2105d00 2021-09-14 stsp $testroot/stdout; then
869 c2105d00 2021-09-14 stsp echo "got send did apparently pack too many objects:" >&2
870 c2105d00 2021-09-14 stsp cat $testroot/stdout.raw >&2
871 c2105d00 2021-09-14 stsp test_done "$testroot" "1"
875 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
877 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
880 26960ff7 2021-09-14 stsp test_send_tag_of_deleted_branch() {
881 26960ff7 2021-09-14 stsp local testroot=`test_init send_tag_of_deleted_branch`
882 26960ff7 2021-09-14 stsp local testurl=ssh://127.0.0.1/$testroot
883 26960ff7 2021-09-14 stsp local commit_id=`git_show_head $testroot/repo`
885 26960ff7 2021-09-14 stsp got clone -q $testurl/repo $testroot/repo-clone
887 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
888 26960ff7 2021-09-14 stsp echo "got clone command failed unexpectedly" >&2
889 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
892 26960ff7 2021-09-14 stsp cat > $testroot/repo/.git/got.conf <<EOF
893 26960ff7 2021-09-14 stsp remote "origin" {
894 26960ff7 2021-09-14 stsp protocol ssh
895 26960ff7 2021-09-14 stsp server 127.0.0.1
896 26960ff7 2021-09-14 stsp repository "$testroot/repo-clone"
899 26960ff7 2021-09-14 stsp got branch -r $testroot/repo foo
901 ce2bf7b7 2022-05-29 stsp # modify beta on branch foo
902 26960ff7 2021-09-14 stsp got checkout -b foo $testroot/repo $testroot/wt > /dev/null
903 26960ff7 2021-09-14 stsp echo boo >> $testroot/wt/beta
904 26960ff7 2021-09-14 stsp (cd $testroot/wt && got commit -m 'changed beta on branch foo' \
905 ce2bf7b7 2022-05-29 stsp > /dev/null)
906 ce2bf7b7 2022-05-29 stsp echo buu >> $testroot/wt/beta
907 ce2bf7b7 2022-05-29 stsp (cd $testroot/wt && got commit -m 'changed beta again on branch foo' \
908 26960ff7 2021-09-14 stsp > /dev/null)
909 ce2bf7b7 2022-05-29 stsp echo baa >> $testroot/wt/beta
910 ce2bf7b7 2022-05-29 stsp (cd $testroot/wt && got commit -m 'changed beta again on branch foo' \
911 ce2bf7b7 2022-05-29 stsp > /dev/null)
912 26960ff7 2021-09-14 stsp local commit_id2=`git_show_branch_head $testroot/repo foo`
914 26960ff7 2021-09-14 stsp # tag HEAD commit of branch foo
915 26960ff7 2021-09-14 stsp got tag -r $testroot/repo -c foo -m '1.0' 1.0 > /dev/null
916 26960ff7 2021-09-14 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
917 26960ff7 2021-09-14 stsp | tr -d ' ' | cut -d: -f2`
919 26960ff7 2021-09-14 stsp # delete the branch; commit is now only reachable via tags/1.0
920 26960ff7 2021-09-14 stsp got branch -r $testroot/repo -d foo > /dev/null
922 26960ff7 2021-09-14 stsp # unrelated change on master branch, then try sending this branch
923 26960ff7 2021-09-14 stsp # and the tag
924 26960ff7 2021-09-14 stsp echo "modified alpha" > $testroot/repo/alpha
925 26960ff7 2021-09-14 stsp git_commit $testroot/repo -m "modified alpha"
926 26960ff7 2021-09-14 stsp local commit_id3=`git_show_head $testroot/repo`
928 26960ff7 2021-09-14 stsp got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
930 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
931 26960ff7 2021-09-14 stsp echo "got send command failed unexpectedly" >&2
932 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
936 26960ff7 2021-09-14 stsp echo -n > $testroot/stdout.expected
937 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
939 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
940 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
941 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
945 26960ff7 2021-09-14 stsp got ref -l -r $testroot/repo > $testroot/stdout
947 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
948 26960ff7 2021-09-14 stsp echo "got ref command failed unexpectedly" >&2
949 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
953 26960ff7 2021-09-14 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
954 26960ff7 2021-09-14 stsp cut -d ':' -f 2 | tr -d ' ')`
955 26960ff7 2021-09-14 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
956 26960ff7 2021-09-14 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
957 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
958 26960ff7 2021-09-14 stsp echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
959 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/master: $commit_id3" \
960 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
961 26960ff7 2021-09-14 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
963 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
965 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
966 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
967 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
971 26960ff7 2021-09-14 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
973 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
974 26960ff7 2021-09-14 stsp echo "got ref command failed unexpectedly" >&2
975 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
979 26960ff7 2021-09-14 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
980 26960ff7 2021-09-14 stsp echo "refs/heads/master: $commit_id3" >> $testroot/stdout.expected
981 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
982 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
983 26960ff7 2021-09-14 stsp echo "refs/remotes/origin/master: $commit_id" \
984 26960ff7 2021-09-14 stsp >> $testroot/stdout.expected
985 26960ff7 2021-09-14 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
987 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
989 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
990 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
991 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
995 26960ff7 2021-09-14 stsp got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
996 26960ff7 2021-09-14 stsp echo "tag 1.0 $tag_id" > $testroot/stdout.expected
998 26960ff7 2021-09-14 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1000 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1001 26960ff7 2021-09-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1002 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1006 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1008 26960ff7 2021-09-14 stsp test_done "$testroot" "$ret"
1011 f8a36e22 2021-08-26 stsp test_send_new_branch() {
1012 f8a36e22 2021-08-26 stsp local testroot=`test_init send_new_branch`
1013 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
1014 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
1016 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config receive.denyCurrentBranch ignore
1018 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1020 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1021 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
1022 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1026 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone foo >/dev/null
1027 f8a36e22 2021-08-26 stsp got checkout -b foo $testroot/repo-clone $testroot/wt >/dev/null
1028 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
1029 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
1030 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_branch_head $testroot/repo-clone foo`
1032 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got send -q > $testroot/stdout 2> $testroot/stderr)
1034 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1035 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1036 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1040 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
1041 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1043 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1044 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1045 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1049 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
1051 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1052 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1053 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1057 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1058 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
1059 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1061 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1063 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1064 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1065 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1069 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1071 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1072 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1073 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1077 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1078 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
1079 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1080 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1081 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1082 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected
1083 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1084 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1085 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1086 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/foo: $commit_id2" \
1087 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1088 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1089 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1091 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1093 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1094 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1095 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1099 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1101 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1104 f8a36e22 2021-08-26 stsp test_send_all_branches() {
1105 f8a36e22 2021-08-26 stsp local testroot=`test_init send_all_branches`
1106 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
1107 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
1109 f73bf5bd 2023-10-01 naddy git -C $testroot/repo config receive.denyCurrentBranch ignore
1111 f8a36e22 2021-08-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1113 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1114 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
1115 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1119 f8a36e22 2021-08-26 stsp got checkout $testroot/repo-clone $testroot/wt >/dev/null
1120 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/wt/alpha
1121 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
1122 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo-clone`
1124 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone foo >/dev/null
1125 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got update -b foo >/dev/null)
1126 f8a36e22 2021-08-26 stsp echo "modified beta on new branch foo" > $testroot/wt/beta
1127 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1128 f8a36e22 2021-08-26 stsp local commit_id3=`git_show_branch_head $testroot/repo-clone foo`
1130 f8a36e22 2021-08-26 stsp got branch -r $testroot/repo-clone bar >/dev/null
1131 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got update -b bar >/dev/null)
1132 f8a36e22 2021-08-26 stsp echo "modified beta again on new branch bar" > $testroot/wt/beta
1133 f8a36e22 2021-08-26 stsp (cd $testroot/wt && got commit -m "modified beta" >/dev/null)
1134 f8a36e22 2021-08-26 stsp local commit_id4=`git_show_branch_head $testroot/repo-clone bar`
1136 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1138 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1139 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1140 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1144 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1145 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1146 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1147 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1149 f8a36e22 2021-08-26 stsp got send -a -q -r $testroot/repo-clone -b master > $testroot/stdout \
1150 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
1152 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1153 f8a36e22 2021-08-26 stsp echo "got send command succeeded unexpectedly" >&2
1154 a19f439c 2022-06-03 op test_done "$testroot" 1
1157 f8a36e22 2021-08-26 stsp echo "got: -a and -b options are mutually exclusive" \
1158 f8a36e22 2021-08-26 stsp > $testroot/stderr.expected
1159 f8a36e22 2021-08-26 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 f8a36e22 2021-08-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
1163 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1167 f8a36e22 2021-08-26 stsp got send -a -q -r $testroot/repo-clone > $testroot/stdout \
1168 f8a36e22 2021-08-26 stsp 2> $testroot/stderr
1170 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1171 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1172 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1176 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
1177 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1179 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1180 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1181 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1185 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
1187 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1188 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1189 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1193 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1194 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1195 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1196 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1198 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1200 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1201 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1202 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1206 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1208 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1209 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1210 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1214 f8a36e22 2021-08-26 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1215 f8a36e22 2021-08-26 stsp cut -d ':' -f 2 | tr -d ' ')`
1216 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1217 f8a36e22 2021-08-26 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id4" \
1218 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1219 f8a36e22 2021-08-26 stsp echo "refs/heads/bar: $commit_id4" >> $testroot/stdout.expected
1220 f8a36e22 2021-08-26 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
1221 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1222 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1223 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1224 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/bar: $commit_id4" \
1225 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1226 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/foo: $commit_id3" \
1227 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1228 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
1229 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1231 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1233 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1234 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1235 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1239 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1241 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1244 f8a36e22 2021-08-26 stsp test_send_to_empty_repo() {
1245 f8a36e22 2021-08-26 stsp local testroot=`test_init send_to_empty_repo`
1246 f8a36e22 2021-08-26 stsp local testurl=ssh://127.0.0.1/$testroot
1247 f8a36e22 2021-08-26 stsp local commit_id=`git_show_head $testroot/repo`
1249 02a5c5d0 2022-07-04 stsp gotadmin init $testroot/repo2
1252 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1253 f8a36e22 2021-08-26 stsp echo "got clone command failed unexpectedly" >&2
1254 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1257 f8a36e22 2021-08-26 stsp cat > $testroot/repo/.git/got.conf <<EOF
1258 f8a36e22 2021-08-26 stsp remote "origin" {
1259 f8a36e22 2021-08-26 stsp protocol ssh
1260 f8a36e22 2021-08-26 stsp server 127.0.0.1
1261 f8a36e22 2021-08-26 stsp repository "$testroot/repo2"
1264 f8a36e22 2021-08-26 stsp echo "modified alpha" > $testroot/repo/alpha
1265 f8a36e22 2021-08-26 stsp git_commit $testroot/repo -m "modified alpha"
1266 f8a36e22 2021-08-26 stsp local commit_id2=`git_show_head $testroot/repo`
1268 f8a36e22 2021-08-26 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1270 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1271 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1272 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1276 f8a36e22 2021-08-26 stsp echo -n > $testroot/stdout.expected
1277 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1279 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1280 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1281 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1285 02a5c5d0 2022-07-04 stsp # XXX Workaround: We cannot give the target for HEAD to 'gotadmin init'
1286 f8a36e22 2021-08-26 stsp got ref -r $testroot/repo2 -s refs/heads/master HEAD
1288 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo > $testroot/stdout
1290 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1291 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1292 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1296 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1297 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1298 f8a36e22 2021-08-26 stsp echo "refs/remotes/origin/master: $commit_id2" \
1299 f8a36e22 2021-08-26 stsp >> $testroot/stdout.expected
1301 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1303 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1304 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1305 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1309 f8a36e22 2021-08-26 stsp got ref -l -r $testroot/repo2 > $testroot/stdout
1311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1312 f8a36e22 2021-08-26 stsp echo "got ref command failed unexpectedly" >&2
1313 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1317 f8a36e22 2021-08-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1318 f8a36e22 2021-08-26 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
1320 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1322 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1323 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1324 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1328 f8a36e22 2021-08-26 stsp got send -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1331 f8a36e22 2021-08-26 stsp echo "got send command failed unexpectedly" >&2
1332 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1336 0deb9607 2022-11-18 op echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo2" \
1337 0deb9607 2022-11-18 op > $testroot/stdout.expected
1338 f8a36e22 2021-08-26 stsp echo "Already up-to-date" >> $testroot/stdout.expected
1339 f8a36e22 2021-08-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1341 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1342 f8a36e22 2021-08-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1343 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1347 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo2"
1349 f8a36e22 2021-08-26 stsp test_done "$testroot" "$ret"
1352 6480c871 2021-08-30 stsp test_send_and_fetch_config() {
1353 6480c871 2021-08-30 stsp local testroot=`test_init send_fetch_conf`
1354 6480c871 2021-08-30 stsp local testurl=ssh://127.0.0.1/$testroot
1355 6480c871 2021-08-30 stsp local commit_id=`git_show_head $testroot/repo`
1357 6480c871 2021-08-30 stsp got clone -q $testurl/repo $testroot/repo-clone
1359 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1360 6480c871 2021-08-30 stsp echo "got clone command failed unexpectedly" >&2
1361 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1365 6480c871 2021-08-30 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
1366 6480c871 2021-08-30 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
1367 6480c871 2021-08-30 stsp | tr -d ' ' | cut -d: -f2`
1369 6480c871 2021-08-30 stsp cp -R $testroot/repo-clone $testroot/repo-clone2
1370 6480c871 2021-08-30 stsp got tag -r $testroot/repo-clone2 -m '2.0' 2.0 >/dev/null
1371 6480c871 2021-08-30 stsp tag_id2=`got ref -r $testroot/repo-clone2 -l | grep "^refs/tags/2.0" \
1372 6480c871 2021-08-30 stsp | tr -d ' ' | cut -d: -f2`
1374 6480c871 2021-08-30 stsp cat > $testroot/repo/.git/got.conf <<EOF
1375 6480c871 2021-08-30 stsp remote "origin" {
1376 6480c871 2021-08-30 stsp protocol ssh
1377 6480c871 2021-08-30 stsp server 127.0.0.1
1379 6480c871 2021-08-30 stsp repository "$testroot/repo-clone"
1382 6480c871 2021-08-30 stsp repository "$testroot/repo-clone2"
1386 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo > $testroot/stdout
1388 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1389 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1390 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1394 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1395 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1396 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1397 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1399 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1400 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1401 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1405 6480c871 2021-08-30 stsp # fetch tag 2.0 from repo-clone2
1406 6480c871 2021-08-30 stsp got fetch -q -r $testroot/repo > $testroot/stdout
1408 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1409 6480c871 2021-08-30 stsp echo "got fetch command failed unexpectedly" >&2
1410 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1414 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo > $testroot/stdout
1416 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1417 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1418 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1422 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1423 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1424 6480c871 2021-08-30 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1425 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1426 6480c871 2021-08-30 stsp echo "refs/remotes/origin/master: $commit_id" \
1427 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1428 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1429 6480c871 2021-08-30 stsp echo "refs/tags/2.0: $tag_id2" >> $testroot/stdout.expected
1430 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1432 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1433 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1434 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1438 6480c871 2021-08-30 stsp # send tag 1.0 to repo-clone
1439 6480c871 2021-08-30 stsp got send -q -r $testroot/repo -t 1.0 > $testroot/stdout
1441 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1442 6480c871 2021-08-30 stsp echo "got send command failed unexpectedly" >&2
1443 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1447 6480c871 2021-08-30 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1449 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1450 6480c871 2021-08-30 stsp echo "got ref command failed unexpectedly" >&2
1451 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1455 6480c871 2021-08-30 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1456 6480c871 2021-08-30 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1457 6480c871 2021-08-30 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1458 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1459 6480c871 2021-08-30 stsp echo "refs/remotes/origin/master: $commit_id" \
1460 6480c871 2021-08-30 stsp >> $testroot/stdout.expected
1461 6480c871 2021-08-30 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1463 6480c871 2021-08-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1465 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1466 6480c871 2021-08-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
1467 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1471 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1473 6480c871 2021-08-30 stsp test_done "$testroot" "$ret"
1476 eac1df47 2021-09-01 stsp test_send_config() {
1477 fa9997e7 2023-09-13 stsp local testroot=`test_init send_config`
1478 eac1df47 2021-09-01 stsp local testurl=ssh://127.0.0.1/$testroot
1479 eac1df47 2021-09-01 stsp local commit_id=`git_show_head $testroot/repo`
1481 eac1df47 2021-09-01 stsp got clone -q $testurl/repo $testroot/repo-clone
1483 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1484 eac1df47 2021-09-01 stsp echo "got clone command failed unexpectedly" >&2
1485 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1489 eac1df47 2021-09-01 stsp cat > $testroot/repo/.git/got.conf <<EOF
1490 eac1df47 2021-09-01 stsp remote "origin" {
1491 eac1df47 2021-09-01 stsp protocol ssh
1492 eac1df47 2021-09-01 stsp server 127.0.0.1
1493 eac1df47 2021-09-01 stsp branch foo
1494 eac1df47 2021-09-01 stsp repository "$testroot/repo-clone"
1497 eac1df47 2021-09-01 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1499 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1500 eac1df47 2021-09-01 stsp echo "got ref command failed unexpectedly" >&2
1501 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1505 eac1df47 2021-09-01 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1506 eac1df47 2021-09-01 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1507 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1508 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1509 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/master: $commit_id" \
1510 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1512 eac1df47 2021-09-01 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1514 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1515 eac1df47 2021-09-01 stsp diff -u $testroot/stdout.expected $testroot/stdout
1516 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1520 eac1df47 2021-09-01 stsp got branch -r $testroot/repo foo
1522 eac1df47 2021-09-01 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1524 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1525 eac1df47 2021-09-01 stsp echo "got send command failed unexpectedly" >&2
1526 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1530 eac1df47 2021-09-01 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1532 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1533 eac1df47 2021-09-01 stsp echo "got ref command failed unexpectedly" >&2
1534 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1538 eac1df47 2021-09-01 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1539 eac1df47 2021-09-01 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1540 eac1df47 2021-09-01 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1541 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1542 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1543 eac1df47 2021-09-01 stsp echo "refs/remotes/origin/master: $commit_id" \
1544 eac1df47 2021-09-01 stsp >> $testroot/stdout.expected
1546 eac1df47 2021-09-01 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1548 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1549 eac1df47 2021-09-01 stsp diff -u $testroot/stdout.expected $testroot/stdout
1550 f0fd0aaf 2021-09-14 stsp test_done "$testroot" "$ret"
1554 f0fd0aaf 2021-09-14 stsp git_fsck "$testroot" "$testroot/repo-clone"
1556 eac1df47 2021-09-01 stsp test_done "$testroot" "$ret"
1559 b624328e 2024-01-25 falsifian test_send_gitconfig() {
1560 b624328e 2024-01-25 falsifian local testroot=`test_init send_config`
1561 b624328e 2024-01-25 falsifian local testurl=ssh://127.0.0.1/$testroot
1562 b624328e 2024-01-25 falsifian local commit_id=`git_show_head $testroot/repo`
1564 b624328e 2024-01-25 falsifian git init -q --bare $testroot/upstream-repo
1565 b624328e 2024-01-25 falsifian ret=$?
1566 b624328e 2024-01-25 falsifian if [ $ret -ne 0 ]; then
1567 b624328e 2024-01-25 falsifian echo "git init failed unexpectedly" >&2
1568 b624328e 2024-01-25 falsifian test_done "$testroot" "$ret"
1569 b624328e 2024-01-25 falsifian return 1
1572 b624328e 2024-01-25 falsifian cat >> $testroot/repo/.git/config <<EOF
1573 b624328e 2024-01-25 falsifian [remote "hasnourl"]
1574 b624328e 2024-01-25 falsifian unrelated = setting
1575 b624328e 2024-01-25 falsifian [remote "foo"]
1576 b624328e 2024-01-25 falsifian url = $testurl/upstream-repo
1577 b624328e 2024-01-25 falsifian [remote "another"]
1578 b624328e 2024-01-25 falsifian url = $testurl/some-other-repo
1581 b624328e 2024-01-25 falsifian # unset in a subshell to avoid affecting our environment
1582 b624328e 2024-01-25 falsifian (unset GOT_IGNORE_GITCONFIG && got send -q -r $testroot/repo foo)
1583 b624328e 2024-01-25 falsifian ret=$?
1584 b624328e 2024-01-25 falsifian if [ $ret -ne 0 ]; then
1585 b624328e 2024-01-25 falsifian echo "got send command failed unexpectedly" >&2
1586 b624328e 2024-01-25 falsifian test_done "$testroot" "$ret"
1587 b624328e 2024-01-25 falsifian return 1
1590 b624328e 2024-01-25 falsifian got ref -l -r $testroot/upstream-repo > $testroot/stdout
1592 b624328e 2024-01-25 falsifian cat > $testroot/stdout.expected <<-EOF
1593 b624328e 2024-01-25 falsifian HEAD: refs/heads/master
1594 b624328e 2024-01-25 falsifian refs/heads/master: $commit_id
1597 b624328e 2024-01-25 falsifian cmp -s $testroot/stdout $testroot/stdout.expected
1598 b624328e 2024-01-25 falsifian ret=$?
1599 b624328e 2024-01-25 falsifian if [ $ret -ne 0 ]; then
1600 b624328e 2024-01-25 falsifian diff -u $testroot/stdout.expected $testroot/stdout
1602 b624328e 2024-01-25 falsifian test_done "$testroot" "$ret"
1605 6242c45b 2022-11-14 op test_send_rejected() {
1606 6242c45b 2022-11-14 op local testroot=`test_init send_rejected`
1607 6242c45b 2022-11-14 op local testurl=ssh://127.0.0.1/$testroot
1608 6242c45b 2022-11-14 op local commit_id=`git_show_head $testroot/repo`
1610 6242c45b 2022-11-14 op if ! got clone -q "$testurl/repo" "$testroot/repo-clone"; then
1611 6242c45b 2022-11-14 op echo "got clone command failed unexpectedly" >&2
1612 6242c45b 2022-11-14 op test_done "$testroot" 1
1616 6242c45b 2022-11-14 op mkdir "$testroot/repo-clone/hooks"
1617 6242c45b 2022-11-14 op cat <<'EOF' >$testroot/repo-clone/hooks/update
1618 6242c45b 2022-11-14 op case "$1" in
1620 6242c45b 2022-11-14 op echo "rejecting push on master branch"
1626 6242c45b 2022-11-14 op chmod +x "$testroot/repo-clone/hooks/update"
1628 6242c45b 2022-11-14 op cat > $testroot/repo/.git/got.conf <<EOF
1629 6242c45b 2022-11-14 op remote "origin" {
1630 6242c45b 2022-11-14 op protocol ssh
1631 6242c45b 2022-11-14 op server 127.0.0.1
1632 6242c45b 2022-11-14 op repository "$testroot/repo-clone"
1636 6242c45b 2022-11-14 op echo "modified alpha" >$testroot/repo/alpha
1637 6242c45b 2022-11-14 op git_commit "$testroot/repo" -m "modified alpha"
1639 6242c45b 2022-11-14 op got send -q -r "$testroot/repo" >$testroot/stdout 2>$testroot/stderr
1641 6242c45b 2022-11-14 op if [ $ret -ne 0 ]; then
1642 6242c45b 2022-11-14 op echo "got send command failed unexpectedly" >&2
1643 6242c45b 2022-11-14 op test_done "$testroot" $ret
1647 6242c45b 2022-11-14 op touch "$testroot/stdout.expected"
1648 6242c45b 2022-11-14 op if ! cmp -s "$testroot/stdout.expected" "$testroot/stdout"; then
1649 6242c45b 2022-11-14 op diff -u "$testroot/stdout.expected" "$testroot/stdout"
1650 6242c45b 2022-11-14 op test_done "$testroot" 1
1654 6242c45b 2022-11-14 op cat <<EOF >$testroot/stderr.expected
1655 6242c45b 2022-11-14 op rejecting push on master branch
1656 6242c45b 2022-11-14 op error: hook declined to update refs/heads/master
1659 6242c45b 2022-11-14 op if ! cmp -s "$testroot/stderr.expected" "$testroot/stderr"; then
1660 6242c45b 2022-11-14 op diff -u "$testroot/stderr.expected" "$testroot/stderr"
1661 6242c45b 2022-11-14 op test_done "$testroot" 1
1665 6242c45b 2022-11-14 op test_done "$testroot" 0
1668 3c7a8227 2024-04-17 stsp test_send_basic_http() {
1669 3c7a8227 2024-04-17 stsp local testroot=`test_init send_basic_http`
1670 3c7a8227 2024-04-17 stsp local testurl=http://127.0.0.1:$GOT_TEST_HTTP_PORT
1671 3c7a8227 2024-04-17 stsp local commit_id=`git_show_head $testroot/repo`
1673 3c7a8227 2024-04-17 stsp timeout 5 ./http-server -p $GOT_TEST_HTTP_PORT $testroot \
1674 3c7a8227 2024-04-17 stsp > $testroot/http-server.log &
1675 c2a5e1d8 2024-04-17 stsp trap "kill %1" HUP INT QUIT PIPE TERM
1677 3c7a8227 2024-04-17 stsp sleep 1 # server starts up
1679 3c7a8227 2024-04-17 stsp got clone -q $testurl/repo $testroot/repo-clone
1681 3c7a8227 2024-04-17 stsp if [ $ret -ne 0 ]; then
1682 3c7a8227 2024-04-17 stsp echo "got clone command failed unexpectedly" >&2
1683 3c7a8227 2024-04-17 stsp test_done "$testroot" "$ret"
1686 3c7a8227 2024-04-17 stsp cat > $testroot/repo/.git/got.conf <<EOF
1687 3c7a8227 2024-04-17 stsp remote "origin" {
1688 3c7a8227 2024-04-17 stsp protocol http
1689 3c7a8227 2024-04-17 stsp server 127.0.0.1
1690 3c7a8227 2024-04-17 stsp port $GOT_TEST_HTTP_PORT
1691 3c7a8227 2024-04-17 stsp repository "/repo-clone"
1694 3c7a8227 2024-04-17 stsp got tag -r $testroot/repo -m '1.0' 1.0 >/dev/null
1695 3c7a8227 2024-04-17 stsp tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \
1696 3c7a8227 2024-04-17 stsp | tr -d ' ' | cut -d: -f2`
1698 3c7a8227 2024-04-17 stsp echo "modified alpha" > $testroot/repo/alpha
1699 3c7a8227 2024-04-17 stsp git -C $testroot/repo rm -q beta
1700 3c7a8227 2024-04-17 stsp (cd $testroot/repo && ln -s epsilon/zeta symlink)
1701 3c7a8227 2024-04-17 stsp git -C $testroot/repo add symlink
1702 3c7a8227 2024-04-17 stsp echo "new file alpha" > $testroot/repo/new
1703 3c7a8227 2024-04-17 stsp git -C $testroot/repo add new
1704 3c7a8227 2024-04-17 stsp git_commit $testroot/repo -m "modified alpha"
1705 3c7a8227 2024-04-17 stsp local commit_id2=`git_show_head $testroot/repo`
1707 3c7a8227 2024-04-17 stsp got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr
1709 3c7a8227 2024-04-17 stsp if [ $ret -eq 0 ]; then
1710 3c7a8227 2024-04-17 stsp echo "got send command succeeded unexpectedly" >&2
1711 3c7a8227 2024-04-17 stsp test_done "$testroot" "$ret"
1716 3c7a8227 2024-04-17 stsp wait %1 # wait for http-server
1718 3c7a8227 2024-04-17 stsp echo "got: http: feature not implemented" > $testroot/stderr.expected
1719 3c7a8227 2024-04-17 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1721 3c7a8227 2024-04-17 stsp if [ $ret -ne 0 ]; then
1722 3c7a8227 2024-04-17 stsp diff -u $testroot/stderr.expected $testroot/stderr
1724 3c7a8227 2024-04-17 stsp test_done "$testroot" "$ret"
1728 f8a36e22 2021-08-26 stsp test_parseargs "$@"
1729 f8a36e22 2021-08-26 stsp run_test test_send_basic
1730 f8a36e22 2021-08-26 stsp run_test test_send_rebase_required
1731 f8a36e22 2021-08-26 stsp run_test test_send_rebase_required_overwrite
1732 e166551f 2023-04-17 stsp run_test test_send_merge_commit
1733 f8a36e22 2021-08-26 stsp run_test test_send_delete
1734 f8a36e22 2021-08-26 stsp run_test test_send_clone_and_send
1735 f8a36e22 2021-08-26 stsp run_test test_send_tags
1736 26960ff7 2021-09-14 stsp run_test test_send_tag_of_deleted_branch
1737 f8a36e22 2021-08-26 stsp run_test test_send_new_branch
1738 f8a36e22 2021-08-26 stsp run_test test_send_all_branches
1739 f8a36e22 2021-08-26 stsp run_test test_send_to_empty_repo
1740 6480c871 2021-08-30 stsp run_test test_send_and_fetch_config
1741 eac1df47 2021-09-01 stsp run_test test_send_config
1742 b624328e 2024-01-25 falsifian run_test test_send_gitconfig
1743 6242c45b 2022-11-14 op run_test test_send_rejected
1744 3c7a8227 2024-04-17 stsp run_test test_send_basic_http