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
37 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
38 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
39 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
43 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
44 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
46 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
47 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
48 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
52 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
54 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
56 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
57 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
58 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
62 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
63 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
64 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
65 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
68 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
69 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
70 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
71 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
74 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
76 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
77 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
78 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
82 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
83 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
84 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
85 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
89 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
90 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
92 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
94 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
95 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
96 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
100 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
101 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
102 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
103 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
107 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
108 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
109 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
110 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
111 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
112 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
114 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
116 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
117 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
119 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
122 f6cae3ed 2020-09-13 naddy test_fetch_list() {
123 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
124 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
125 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
127 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
128 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
129 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
131 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
133 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
134 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
135 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
139 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l \
140 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
142 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
143 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
144 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
148 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
150 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
152 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
153 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
155 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
158 f6cae3ed 2020-09-13 naddy test_fetch_branch() {
159 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
160 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
161 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
163 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
165 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
166 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
167 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
171 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
172 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
173 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
174 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
175 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
177 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
178 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
179 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
181 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
182 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
183 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
184 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
186 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
188 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
189 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
190 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
194 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
196 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
198 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
199 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
200 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
204 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
206 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
207 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
208 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
209 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
210 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
211 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
212 c8c71e6e 2020-03-21 stsp # refs/remotes/origin/master is umodified because it wasn't fetched
213 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
214 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
215 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
216 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
218 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
220 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
221 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
222 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
226 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
228 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
229 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
230 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
234 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
236 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
238 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
239 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
240 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
244 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
246 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
247 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
248 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
249 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
250 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
251 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
252 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
253 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
254 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
255 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
257 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
259 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
260 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
262 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
265 f6cae3ed 2020-09-13 naddy test_fetch_all() {
266 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
267 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
268 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
270 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
272 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
273 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
274 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
278 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
279 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
280 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
281 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
282 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
284 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
286 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
287 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
288 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
289 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
290 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
291 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
292 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
294 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
296 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
297 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
298 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
302 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
304 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
305 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
306 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
310 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
312 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
313 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
314 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
315 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
316 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
317 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
318 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
319 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
320 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
321 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
323 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
325 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
326 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
328 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
331 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
332 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
333 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
334 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
336 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
337 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
338 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
340 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
342 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
343 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
344 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
348 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
349 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
351 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
353 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
354 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
355 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
356 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
357 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
358 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
359 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
360 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
362 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
364 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
365 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
366 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
370 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
372 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
373 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
374 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
378 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
380 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
381 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
382 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
383 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
384 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
385 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
386 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
387 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
388 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
389 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
391 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
393 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
394 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
396 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
399 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
400 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
401 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
402 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
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
407 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
408 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
409 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
411 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
413 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
414 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
415 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
419 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
421 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
422 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
423 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
424 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
425 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
426 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
427 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
428 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
429 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
430 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
431 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
433 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
435 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
436 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
437 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
441 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
443 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
445 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
446 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
447 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
451 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
453 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
454 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
455 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
456 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
457 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
458 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
459 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
460 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
461 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
462 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
464 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
466 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
467 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
468 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
472 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
474 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
475 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
476 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
480 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
482 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
484 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
485 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
486 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
490 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
492 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
493 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
494 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
495 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
496 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
497 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
498 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
499 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
500 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
501 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
503 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
505 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
506 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
508 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
512 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
513 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
514 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
515 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
517 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
518 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
519 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
520 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
521 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
523 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
525 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
526 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
527 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
531 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
533 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
534 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
535 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
536 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
537 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
539 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
541 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
542 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
543 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
547 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
549 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
551 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
552 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
553 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
557 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
559 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
560 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
561 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
562 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
563 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
565 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
567 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
568 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
569 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
573 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
575 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
576 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
577 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
581 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
583 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
585 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
586 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
587 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
591 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
593 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
594 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
595 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
596 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
597 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
599 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
601 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
602 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
604 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
608 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
609 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
610 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
611 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
614 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
615 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
616 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
617 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
618 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
620 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
622 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
623 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
624 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
628 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
629 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
630 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
632 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
633 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
634 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
635 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
637 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
639 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
640 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
641 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
642 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
643 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
644 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
645 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
646 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
647 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
648 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
649 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
651 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
653 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
654 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
655 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
659 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
661 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
662 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
663 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
667 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
669 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
670 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
671 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
672 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
673 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
674 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
675 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
676 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
677 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
678 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
680 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
682 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
683 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
684 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
688 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
689 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
691 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
692 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
693 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
697 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
698 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
700 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
702 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
703 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
704 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
708 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
710 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
711 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
712 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
713 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
714 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
715 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
716 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
717 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
718 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
719 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
721 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
723 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
724 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
725 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
729 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
731 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
732 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
733 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
737 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
739 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
741 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
742 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
743 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
747 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
749 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
750 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
751 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
752 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
753 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
754 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
755 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
756 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
757 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
758 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
760 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
762 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
763 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
765 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
768 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
769 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
770 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
771 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
773 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
775 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
776 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
777 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
781 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
782 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
783 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
784 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
785 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
787 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
788 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
789 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
791 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
792 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
793 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
794 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
795 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
797 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
798 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
800 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
801 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
802 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
806 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
808 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
810 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
811 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
812 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
816 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
817 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
819 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
821 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
822 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
823 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
827 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
829 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
830 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
831 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
835 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
837 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
838 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
839 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
840 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
841 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
842 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
843 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
844 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
845 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
847 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
849 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
850 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
852 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
856 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
857 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
858 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
859 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
861 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
863 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
864 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
865 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
869 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
870 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
872 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
874 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
875 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
876 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
878 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
880 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
881 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
882 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
886 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
887 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
889 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
890 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
891 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
895 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
896 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
898 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
900 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
901 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
902 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
906 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
908 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
909 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
910 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
912 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
914 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
915 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
917 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
921 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
922 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
923 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
924 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
926 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
928 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
929 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
930 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
934 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
936 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
937 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
938 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
939 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
940 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
941 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
943 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
945 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
946 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
947 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
951 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
952 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
953 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
955 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
956 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
957 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
959 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
961 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
962 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
963 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
967 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
969 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
971 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
972 15d3c221 2021-01-05 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
973 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
974 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
975 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
976 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
978 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
980 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
981 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
982 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
986 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
988 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
990 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
991 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
992 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
993 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
994 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
995 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
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
1005 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1008 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1009 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1010 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1011 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1013 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1015 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1016 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1017 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1021 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1023 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1024 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1025 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1026 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1027 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1028 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1030 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1032 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1033 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1034 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1038 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1040 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1042 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1043 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1044 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1047 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1049 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1050 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1051 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1052 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1053 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1054 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1055 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1057 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1059 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1060 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1065 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1066 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1067 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1068 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1070 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1071 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1072 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1074 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1076 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1077 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1078 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1082 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1083 50b0790e 2020-09-11 stsp remote "foobar" {
1084 50b0790e 2020-09-11 stsp protocol ssh
1085 50b0790e 2020-09-11 stsp server 127.0.0.1
1086 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1089 50b0790e 2020-09-11 stsp remote "barbaz" {
1090 50b0790e 2020-09-11 stsp protocol ssh
1091 50b0790e 2020-09-11 stsp server 127.0.0.1
1092 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
1095 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1096 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1097 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1098 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1100 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1101 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1102 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1103 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1107 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1108 50b0790e 2020-09-11 stsp > $testroot/stdout)
1110 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1111 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1112 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1116 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1118 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1120 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1121 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1122 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1126 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1128 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1129 50b0790e 2020-09-11 stsp remote "barbaz" {
1130 50b0790e 2020-09-11 stsp protocol ssh
1131 50b0790e 2020-09-11 stsp server 127.0.0.1
1132 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1135 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1137 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1138 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1139 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1143 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1145 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1147 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1148 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1149 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1153 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1154 99495ddb 2021-01-10 stsp remote "origin" {
1155 99495ddb 2021-01-10 stsp protocol ssh
1156 99495ddb 2021-01-10 stsp server 127.0.0.1
1157 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1158 99495ddb 2021-01-10 stsp branch { "foo" }
1159 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1162 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1164 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1165 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1166 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1167 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1168 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1169 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1170 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1171 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1172 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1173 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1174 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1175 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1176 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1177 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1179 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1181 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1183 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1184 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1186 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1189 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1190 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1191 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1192 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1194 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1196 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1197 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1198 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1202 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1203 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1204 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1205 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1209 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1210 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1211 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1212 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1213 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1214 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1216 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1218 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1219 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1220 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1224 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1225 161728eb 2021-07-24 stsp 2> $testroot/stderr
1227 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1228 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1229 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1233 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1234 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1236 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1237 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1238 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1242 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1243 161728eb 2021-07-24 stsp 2> $testroot/stderr
1245 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1246 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1247 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1251 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1252 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1253 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1254 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1256 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1258 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1259 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1260 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1264 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1265 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1266 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1267 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1271 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1272 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $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
1279 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1283 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1284 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1285 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1286 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1287 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1288 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1289 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1290 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1291 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1292 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1293 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1294 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1295 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1296 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1297 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs