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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 49c543a6 2022-03-31 naddy 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 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
193 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
194 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
195 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
199 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
201 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
203 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
204 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
205 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
209 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
211 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
212 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
213 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
214 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
215 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
216 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
217 c8c71e6e 2020-03-21 stsp # refs/remotes/origin/master is umodified because it wasn't fetched
218 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
219 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
220 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
221 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
223 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
225 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
226 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
227 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
231 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
233 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
234 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
235 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
239 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
241 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
243 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
244 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
245 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
249 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
251 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
252 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
253 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
254 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
255 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
256 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
257 0c091d87 2023-02-02 stsp echo "refs/remotes/origin/master: $commit_id2" \
258 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
259 0c091d87 2023-02-02 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
260 0c091d87 2023-02-02 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
262 0c091d87 2023-02-02 stsp cmp -s $testroot/stdout $testroot/stdout.expected
264 0c091d87 2023-02-02 stsp if [ $ret -ne 0 ]; then
265 0c091d87 2023-02-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 0c091d87 2023-02-02 stsp test_done "$testroot" "$ret"
270 0c091d87 2023-02-02 stsp echo "modified beta on foo" > $testroot/repo/beta
271 0c091d87 2023-02-02 stsp git_commit $testroot/repo -m "modified beta"
272 0c091d87 2023-02-02 stsp local commit_id4=`git_show_head $testroot/repo`
274 0c091d87 2023-02-02 stsp got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
276 0c091d87 2023-02-02 stsp # fetch new commits on branch 'foo', implicitly obtaining the
277 0c091d87 2023-02-02 stsp # branch name from a work tree
278 0c091d87 2023-02-02 stsp (cd $testroot/wt && got fetch -q > $testroot/stdout)
280 0c091d87 2023-02-02 stsp echo -n > $testroot/stdout.expected
282 0c091d87 2023-02-02 stsp cmp -s $testroot/stdout $testroot/stdout.expected
284 0c091d87 2023-02-02 stsp if [ $ret -ne 0 ]; then
285 0c091d87 2023-02-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
286 0c091d87 2023-02-02 stsp test_done "$testroot" "$ret"
290 0c091d87 2023-02-02 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
291 0c091d87 2023-02-02 stsp cut -d ':' -f 2 | tr -d ' ')`
293 0c091d87 2023-02-02 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
295 0c091d87 2023-02-02 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
296 0c091d87 2023-02-02 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
297 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
298 0c091d87 2023-02-02 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
299 0c091d87 2023-02-02 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
300 0c091d87 2023-02-02 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
301 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
302 0c091d87 2023-02-02 stsp echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
303 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
304 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
305 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
306 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
308 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
310 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
311 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
316 f6cae3ed 2020-09-13 naddy test_fetch_all() {
317 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
318 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
319 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
321 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
323 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
324 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
325 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
329 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
330 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
331 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
332 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
333 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
335 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
337 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
338 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
339 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
340 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
341 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
342 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
343 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
345 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
347 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
348 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
349 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
353 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
355 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
356 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
357 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
361 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
363 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
364 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
365 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
366 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
367 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
368 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
369 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
370 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
371 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
372 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
374 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
376 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
377 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
379 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
382 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
383 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
384 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
385 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
387 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
388 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
389 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
391 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
393 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
394 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
395 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
399 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
400 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
402 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
404 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
405 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
406 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
407 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
408 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
409 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
410 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
411 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
413 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
415 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
416 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
417 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
421 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
423 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
424 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
425 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
429 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
431 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
432 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
433 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
434 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
435 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
436 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
437 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
438 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
439 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
440 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
442 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
444 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
445 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
447 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
450 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
451 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
452 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
453 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
456 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
457 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
458 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
459 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
460 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
462 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
464 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
465 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
466 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
470 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
472 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
473 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
474 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
475 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
476 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
477 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
478 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
479 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
480 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
481 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
482 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
484 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
486 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
487 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
488 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
492 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
494 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
496 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
497 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
498 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
502 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
504 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
505 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
506 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
507 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
508 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
509 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
510 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
511 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
512 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
513 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
515 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
517 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
518 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
519 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
523 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
525 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
526 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
527 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
531 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
533 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
535 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
536 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
537 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
541 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
543 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
544 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
545 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
546 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
547 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
548 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
549 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
550 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
551 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
552 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
554 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
557 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
559 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
563 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
564 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
565 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
566 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
568 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
569 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
570 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
571 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
572 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
574 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
576 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
577 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
578 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
582 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
584 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
585 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
586 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
587 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
588 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
590 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
592 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
593 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
594 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
598 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
600 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
602 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
603 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
604 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
608 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
610 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
611 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
612 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
613 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
614 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
616 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
618 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
619 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
620 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
624 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
626 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
627 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
628 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
632 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
634 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
636 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
637 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
638 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
642 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
644 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
645 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
646 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
647 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
648 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
650 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
652 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
653 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
655 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
659 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
660 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
661 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
662 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
665 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
666 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
667 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
668 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
669 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
671 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
673 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
674 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
675 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
679 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
680 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
681 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
683 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
684 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
685 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
686 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
688 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
690 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
691 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
692 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
693 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
694 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
695 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
696 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
697 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
698 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
699 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
700 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
702 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
704 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
705 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
706 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
710 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
712 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
713 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
714 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
718 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
720 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
721 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
722 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
723 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
724 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
725 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
726 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
727 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
728 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
729 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
731 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
733 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
734 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
735 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
739 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
740 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
742 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
743 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
744 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
748 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
749 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
751 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
753 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
754 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
755 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
759 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
761 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
762 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
763 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
764 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
765 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
766 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
767 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
768 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
769 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
770 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
772 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
774 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
775 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
776 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
780 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
782 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
783 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
784 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
788 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
790 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
792 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
793 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
794 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
798 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
800 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
801 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
802 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
803 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
804 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
805 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
806 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
807 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
808 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
809 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
811 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
813 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
814 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
816 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
819 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
820 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
821 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
822 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
824 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
826 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
827 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
828 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
832 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
833 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
834 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
835 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
836 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
838 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
839 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
840 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
842 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
843 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
844 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
845 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
846 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
848 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
849 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
851 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
852 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
853 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
857 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
859 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
861 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
862 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
863 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
867 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
868 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
870 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
872 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
873 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
874 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
878 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
880 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
881 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
882 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
886 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
888 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
889 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
890 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
891 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
892 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
893 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
894 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
895 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
896 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
898 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
900 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
901 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
903 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
907 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
908 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
909 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
910 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
912 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
914 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
915 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
916 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
920 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
921 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
923 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
925 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
926 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
927 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
929 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
931 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
932 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
933 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
937 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
938 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
940 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
941 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
942 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
946 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
947 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
949 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
951 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
952 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
953 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
957 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
959 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
960 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
961 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
963 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
965 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
966 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
968 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
972 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
973 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
974 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
975 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
977 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
980 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
981 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
985 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
987 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
988 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
989 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
990 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
991 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
992 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
994 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
996 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
997 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
998 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1002 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1003 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
1004 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
1006 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1007 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1008 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1010 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1012 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1013 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1014 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1018 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
1020 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1022 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1023 15d3c221 2021-01-05 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1024 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1025 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1026 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
1027 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1029 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1031 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1032 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1033 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
1037 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
1039 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1041 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1042 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1043 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1044 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1045 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1046 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
1047 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1048 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1049 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1051 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1053 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1054 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1056 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1059 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1060 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1061 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1062 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1064 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1066 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1067 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1068 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1072 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1074 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1075 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1076 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1077 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1078 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1079 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1081 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1083 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1084 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1085 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1089 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1091 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1093 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1094 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1095 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1098 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1100 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1101 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1102 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1103 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1104 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1105 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1106 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1108 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1110 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1111 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1113 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1116 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1117 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1118 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1119 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1121 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1122 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1123 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1125 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1127 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1128 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1129 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1133 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1134 50b0790e 2020-09-11 stsp remote "foobar" {
1135 50b0790e 2020-09-11 stsp protocol ssh
1136 50b0790e 2020-09-11 stsp server 127.0.0.1
1137 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1140 50b0790e 2020-09-11 stsp remote "barbaz" {
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/does-not-exist"
1146 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1147 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1148 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1149 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1151 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1152 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1153 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1154 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1158 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1159 50b0790e 2020-09-11 stsp > $testroot/stdout)
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1163 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1167 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1169 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1171 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1172 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1173 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1177 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1179 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1180 50b0790e 2020-09-11 stsp remote "barbaz" {
1181 50b0790e 2020-09-11 stsp protocol ssh
1182 50b0790e 2020-09-11 stsp server 127.0.0.1
1183 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1186 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1188 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1189 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1190 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1194 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1196 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1198 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1199 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1200 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1204 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1205 99495ddb 2021-01-10 stsp remote "origin" {
1206 99495ddb 2021-01-10 stsp protocol ssh
1207 99495ddb 2021-01-10 stsp server 127.0.0.1
1208 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1209 99495ddb 2021-01-10 stsp branch { "foo" }
1210 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1213 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1215 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1216 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1217 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1218 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1219 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1220 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1221 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1222 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1223 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1224 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1225 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1226 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1227 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1228 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1230 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1232 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1234 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1235 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1237 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1240 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1241 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1242 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1243 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1245 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1247 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1248 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1249 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1253 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1255 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1256 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1257 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1261 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1262 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1263 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1264 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1265 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1266 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1268 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1270 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1271 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1272 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1276 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1277 161728eb 2021-07-24 stsp 2> $testroot/stderr
1279 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1280 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1281 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1285 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1286 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1288 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1289 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1290 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1294 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1295 161728eb 2021-07-24 stsp 2> $testroot/stderr
1297 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1298 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1299 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1303 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1304 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1305 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1306 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1308 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1310 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1311 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1312 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1316 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1318 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1319 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1320 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1324 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1325 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1327 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1329 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1330 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1332 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1336 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1337 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1338 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1339 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1340 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1341 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1342 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1343 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1344 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1345 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1346 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1347 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1348 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1349 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1350 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs