3 c8c71e6e 2020-03-21 stsp # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 c8c71e6e 2020-03-21 stsp # Permission to use, copy, modify, and distribute this software for any
6 c8c71e6e 2020-03-21 stsp # purpose with or without fee is hereby granted, provided that the above
7 c8c71e6e 2020-03-21 stsp # copyright notice and this permission notice appear in all copies.
9 c8c71e6e 2020-03-21 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c8c71e6e 2020-03-21 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c8c71e6e 2020-03-21 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c8c71e6e 2020-03-21 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c8c71e6e 2020-03-21 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c8c71e6e 2020-03-21 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c8c71e6e 2020-03-21 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c8c71e6e 2020-03-21 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_fetch_basic() {
20 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_basic`
21 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
22 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
24 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
26 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
27 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
28 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
32 c8c71e6e 2020-03-21 stsp echo "modified alpha" > $testroot/repo/alpha
33 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
34 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
36 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
38 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
39 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
40 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
44 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
45 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
47 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
48 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
49 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
53 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
55 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
57 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
58 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
59 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
63 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
65 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
66 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
67 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
70 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
72 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
73 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
74 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
77 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
79 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
80 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
81 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
85 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
87 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
88 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
89 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
93 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
94 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
96 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
98 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
99 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
100 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
104 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
106 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
107 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
108 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
112 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
113 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
114 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
115 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
116 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
117 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
119 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
121 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
122 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
124 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
127 f6cae3ed 2020-09-13 naddy test_fetch_list() {
128 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
129 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
130 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
132 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
133 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
134 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
136 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
138 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
139 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
140 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
144 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l \
145 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
147 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
148 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
149 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
153 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
155 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
157 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
158 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
160 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
163 f6cae3ed 2020-09-13 naddy test_fetch_branch() {
164 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
165 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
166 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
168 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
170 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
171 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
172 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
176 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
177 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
178 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
179 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
180 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
182 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
183 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
184 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
186 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
187 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
188 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
189 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
191 8d0dceb3 2023-02-07 thomas # foo is now the default HEAD branch in $testroot/repo
192 8d0dceb3 2023-02-07 thomas # but got.conf still says to fetch "master"
193 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
195 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
196 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
197 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
201 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
203 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
205 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
206 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
207 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
211 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
213 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
214 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
215 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
216 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
217 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
218 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
219 c8c71e6e 2020-03-21 stsp # refs/remotes/origin/master is umodified because it wasn't fetched
220 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
221 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
222 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
223 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
225 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
227 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
228 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
229 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
233 8d0dceb3 2023-02-07 thomas # got.conf tells us to fetch the 'master' branch by default
234 8d0dceb3 2023-02-07 thomas got fetch -q -r $testroot/repo-clone > $testroot/stdout
236 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
237 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
238 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
242 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
244 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
246 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
247 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
248 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
252 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
254 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
255 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
256 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
257 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
258 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
259 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
260 91b10dd2 2023-02-03 thomas echo "refs/remotes/origin/master: $commit_id2" \
261 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
262 91b10dd2 2023-02-03 thomas # refs/hoo/boo/zoo is missing because it is outside of refs/heads
263 91b10dd2 2023-02-03 thomas echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
265 91b10dd2 2023-02-03 thomas cmp -s $testroot/stdout $testroot/stdout.expected
267 91b10dd2 2023-02-03 thomas if [ $ret -ne 0 ]; then
268 91b10dd2 2023-02-03 thomas diff -u $testroot/stdout.expected $testroot/stdout
269 91b10dd2 2023-02-03 thomas test_done "$testroot" "$ret"
273 91b10dd2 2023-02-03 thomas echo "modified beta on foo" > $testroot/repo/beta
274 91b10dd2 2023-02-03 thomas git_commit $testroot/repo -m "modified beta"
275 91b10dd2 2023-02-03 thomas local commit_id4=`git_show_head $testroot/repo`
277 8d0dceb3 2023-02-07 thomas # set the default HEAD branch back to master
278 8d0dceb3 2023-02-07 thomas (cd $testroot/repo && git checkout -q master)
280 91b10dd2 2023-02-03 thomas got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
282 91b10dd2 2023-02-03 thomas # fetch new commits on branch 'foo', implicitly obtaining the
283 91b10dd2 2023-02-03 thomas # branch name from a work tree
284 91b10dd2 2023-02-03 thomas (cd $testroot/wt && got fetch -q > $testroot/stdout)
286 91b10dd2 2023-02-03 thomas echo -n > $testroot/stdout.expected
288 91b10dd2 2023-02-03 thomas cmp -s $testroot/stdout $testroot/stdout.expected
290 91b10dd2 2023-02-03 thomas if [ $ret -ne 0 ]; then
291 91b10dd2 2023-02-03 thomas diff -u $testroot/stdout.expected $testroot/stdout
292 91b10dd2 2023-02-03 thomas test_done "$testroot" "$ret"
296 91b10dd2 2023-02-03 thomas wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
297 91b10dd2 2023-02-03 thomas cut -d ':' -f 2 | tr -d ' ')`
299 91b10dd2 2023-02-03 thomas got ref -l -r $testroot/repo-clone > $testroot/stdout
301 91b10dd2 2023-02-03 thomas echo "HEAD: refs/heads/master" > $testroot/stdout.expected
302 91b10dd2 2023-02-03 thomas echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
303 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
304 91b10dd2 2023-02-03 thomas echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
305 91b10dd2 2023-02-03 thomas echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
306 8d0dceb3 2023-02-07 thomas echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
307 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
308 91b10dd2 2023-02-03 thomas echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
309 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
310 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
311 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
312 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
314 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
316 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
317 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
319 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
322 f6cae3ed 2020-09-13 naddy test_fetch_all() {
323 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
324 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
325 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
327 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
329 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
330 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
331 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
335 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
336 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
337 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
338 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
339 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
341 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
343 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
344 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
345 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
346 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
347 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
348 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
349 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
351 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
353 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
354 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
355 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
359 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
361 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
362 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
363 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
367 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
369 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
370 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
371 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
372 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
373 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
374 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
375 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
376 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
377 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
378 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
380 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
382 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
383 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
385 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
388 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
389 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
390 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
391 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
393 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
394 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
395 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
397 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
399 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
400 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
401 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
405 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
406 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
408 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
410 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
411 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
412 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
413 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
414 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
415 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
416 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
417 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
419 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
421 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
422 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
423 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
427 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
429 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
430 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
431 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
435 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
437 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
438 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
439 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
440 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
441 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
442 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
443 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
444 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
445 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
446 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
448 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
450 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
451 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
453 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
456 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
457 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
458 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
459 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
462 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
463 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
464 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
465 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
466 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
468 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
470 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
471 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
472 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
476 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
478 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
479 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
480 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
481 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
482 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
483 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
484 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
485 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
486 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
487 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
488 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
490 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
492 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
493 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
494 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
498 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
500 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
502 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
503 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
504 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
508 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
510 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
511 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
512 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
513 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
514 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
515 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
516 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
517 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
518 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
519 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
521 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
523 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
524 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
525 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
529 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
531 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
532 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
533 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
537 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
539 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
541 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
542 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
543 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
547 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
549 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
550 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
551 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
552 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
553 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
554 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
555 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
556 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
557 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
558 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
560 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
562 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
563 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
565 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
569 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
570 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
571 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
572 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
574 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
575 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
576 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
577 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
578 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
580 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
582 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
583 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
584 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
588 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
590 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
591 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
592 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
593 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
594 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
596 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
598 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
599 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
600 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
604 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
606 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
608 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
609 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
610 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
614 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
616 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
617 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
618 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
619 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
620 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
622 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
624 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
625 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
626 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
630 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
632 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
633 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
634 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
638 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
640 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
642 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
643 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
644 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
648 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
650 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
651 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
652 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
653 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
654 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
656 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
658 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
659 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
661 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
665 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
666 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
667 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
668 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
671 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
672 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
673 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
674 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
675 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
677 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
679 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
680 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
681 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
685 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
686 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
687 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
689 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
690 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
691 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
692 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
694 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
696 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
697 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
698 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
699 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
700 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
701 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
702 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
703 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
704 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
705 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
706 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
708 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
710 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
711 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
712 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
716 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
718 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
719 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
720 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
724 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
726 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
727 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
728 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
729 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
730 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
731 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
732 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
733 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
734 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
735 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
737 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
739 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
740 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
741 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
745 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
746 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
748 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
749 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
750 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
754 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
755 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
757 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
759 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
760 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
761 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
765 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
767 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
768 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
769 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
770 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
771 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
772 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
773 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
774 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
775 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
776 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
778 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
780 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
781 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
782 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
786 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
788 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
789 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
790 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
794 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
796 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
798 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
799 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
800 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
804 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
806 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
807 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
808 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
809 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
810 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
811 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
812 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
813 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
814 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
815 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
817 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
819 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
820 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
822 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
825 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
826 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
827 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
828 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
830 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
832 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
833 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
834 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
838 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
839 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
840 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
841 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
842 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
844 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
845 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
846 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
848 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
849 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
850 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
851 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
852 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
854 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
855 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
857 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
858 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
859 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
863 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
865 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
867 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
868 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
869 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
873 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
874 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
876 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
878 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
879 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
880 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
884 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
886 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
887 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
888 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
892 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
894 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
895 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
896 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
897 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
898 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
899 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
900 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
901 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
902 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
904 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
906 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
907 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
909 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
913 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
914 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
915 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
916 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
918 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
920 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
921 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
922 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
926 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
927 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
929 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
931 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
932 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
933 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
935 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
937 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
938 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
939 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
943 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
944 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
946 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
947 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
948 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
952 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
953 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
955 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
957 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
958 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
959 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
963 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
965 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
966 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
967 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
969 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
971 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
972 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
974 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
978 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
979 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
980 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
981 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
983 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
985 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
986 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
987 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
991 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
993 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
994 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
995 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
996 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
997 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
998 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1000 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1002 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1003 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1004 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1008 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1009 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
1010 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
1012 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1013 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1014 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1016 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1018 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1019 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1020 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1024 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
1026 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1028 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1029 15d3c221 2021-01-05 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1030 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1031 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1032 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
1033 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1035 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1037 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1038 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1039 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
1043 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
1045 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1047 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1048 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1049 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1050 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1051 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1052 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
1053 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1054 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1055 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1057 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1059 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1060 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1065 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1066 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1067 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1068 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1070 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1072 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1073 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1074 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1078 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1080 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1081 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1082 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1083 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1084 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1085 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1087 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1089 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1090 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1091 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1095 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1097 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1099 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1100 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1101 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1104 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1106 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1107 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1108 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1109 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1110 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1111 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1112 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1114 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1116 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1117 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1119 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1122 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1123 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1124 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1125 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1127 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1128 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1129 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1131 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1133 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1134 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1135 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1139 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1140 50b0790e 2020-09-11 stsp remote "foobar" {
1141 50b0790e 2020-09-11 stsp protocol ssh
1142 50b0790e 2020-09-11 stsp server 127.0.0.1
1143 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1146 50b0790e 2020-09-11 stsp remote "barbaz" {
1147 50b0790e 2020-09-11 stsp protocol ssh
1148 50b0790e 2020-09-11 stsp server 127.0.0.1
1149 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
1152 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1153 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1154 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1155 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1157 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1158 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1159 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1160 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1164 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1165 50b0790e 2020-09-11 stsp > $testroot/stdout)
1167 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1168 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1169 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1173 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1175 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1177 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1178 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1179 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1183 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1185 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1186 50b0790e 2020-09-11 stsp remote "barbaz" {
1187 50b0790e 2020-09-11 stsp protocol ssh
1188 50b0790e 2020-09-11 stsp server 127.0.0.1
1189 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1192 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1194 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1195 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1196 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1200 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1202 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1204 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1205 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1206 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1210 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1211 99495ddb 2021-01-10 stsp remote "origin" {
1212 99495ddb 2021-01-10 stsp protocol ssh
1213 99495ddb 2021-01-10 stsp server 127.0.0.1
1214 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1215 99495ddb 2021-01-10 stsp branch { "foo" }
1216 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1219 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1221 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1222 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1223 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1224 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1225 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1226 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1227 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1228 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1229 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1230 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1231 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1232 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1233 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1234 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1236 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1238 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1240 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1241 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1243 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1246 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1247 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1248 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1249 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1251 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1253 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1254 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1255 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1259 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1261 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1262 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1263 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1267 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1268 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1269 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1270 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1271 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1272 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1274 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1276 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1277 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1278 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1282 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1283 161728eb 2021-07-24 stsp 2> $testroot/stderr
1285 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1286 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1287 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1291 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1292 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1294 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1295 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1296 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1300 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1301 161728eb 2021-07-24 stsp 2> $testroot/stderr
1303 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1304 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1305 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1309 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1310 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1311 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1312 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1314 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1316 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1317 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1318 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1322 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1324 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1325 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1326 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1330 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1331 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1333 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1335 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1336 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1338 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1342 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1343 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1344 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1345 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1346 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1347 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1348 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1349 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1350 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1351 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1352 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1353 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1354 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1355 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1356 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs