3 c8c71e6e 2020-03-21 stsp # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 c8c71e6e 2020-03-21 stsp # Permission to use, copy, modify, and distribute this software for any
6 c8c71e6e 2020-03-21 stsp # purpose with or without fee is hereby granted, provided that the above
7 c8c71e6e 2020-03-21 stsp # copyright notice and this permission notice appear in all copies.
9 c8c71e6e 2020-03-21 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c8c71e6e 2020-03-21 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c8c71e6e 2020-03-21 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c8c71e6e 2020-03-21 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c8c71e6e 2020-03-21 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c8c71e6e 2020-03-21 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c8c71e6e 2020-03-21 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c8c71e6e 2020-03-21 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_fetch_basic() {
20 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_basic`
21 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
22 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
24 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
26 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
27 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
28 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
32 c8c71e6e 2020-03-21 stsp echo "modified alpha" > $testroot/repo/alpha
33 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
34 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
36 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
38 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
39 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
40 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
44 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
45 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
47 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
48 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
49 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
53 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
55 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
57 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
58 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
59 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
63 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
65 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
66 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
67 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
70 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
72 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
73 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
74 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
77 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
79 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
80 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
81 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
85 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
87 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
88 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
89 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
93 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
94 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
96 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
98 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
99 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
100 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
104 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
106 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
107 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
108 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
112 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
113 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
114 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
115 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
116 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
117 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
119 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
121 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
122 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
124 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
127 f6cae3ed 2020-09-13 naddy test_fetch_list() {
128 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
129 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
130 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
132 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
133 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
134 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
136 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
138 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
139 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
140 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
144 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l \
145 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
147 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
148 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
149 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
153 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
155 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
157 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
158 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
160 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
163 f6cae3ed 2020-09-13 naddy test_fetch_branch() {
164 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
165 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
166 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
168 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
170 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
171 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
172 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
176 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
177 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
178 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
179 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
180 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
182 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
183 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
184 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
186 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
187 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
188 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
189 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
191 8d0dceb3 2023-02-07 thomas # foo is now the default HEAD branch in $testroot/repo
192 8d0dceb3 2023-02-07 thomas # but got.conf still says to fetch "master"
193 9d0a7ee3 2023-02-07 thomas got fetch -q -r $testroot/repo-clone > $testroot/stdout
195 9d0a7ee3 2023-02-07 thomas if [ $ret -ne 0 ]; then
196 9d0a7ee3 2023-02-07 thomas echo "got fetch command failed unexpectedly" >&2
197 9d0a7ee3 2023-02-07 thomas test_done "$testroot" "$ret"
201 9d0a7ee3 2023-02-07 thomas echo -n > $testroot/stdout.expected
203 9d0a7ee3 2023-02-07 thomas cmp -s $testroot/stdout $testroot/stdout.expected
205 9d0a7ee3 2023-02-07 thomas if [ $ret -ne 0 ]; then
206 9d0a7ee3 2023-02-07 thomas diff -u $testroot/stdout.expected $testroot/stdout
207 9d0a7ee3 2023-02-07 thomas test_done "$testroot" "$ret"
211 9d0a7ee3 2023-02-07 thomas got ref -l -r $testroot/repo-clone > $testroot/stdout
213 9d0a7ee3 2023-02-07 thomas echo "HEAD: refs/heads/master" > $testroot/stdout.expected
214 9d0a7ee3 2023-02-07 thomas echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
215 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
216 9d0a7ee3 2023-02-07 thomas >> $testroot/stdout.expected
217 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/master: $commit_id2" \
218 9d0a7ee3 2023-02-07 thomas >> $testroot/stdout.expected
219 9d0a7ee3 2023-02-07 thomas # refs/hoo/boo/zoo is missing because it is outside of refs/heads
220 9d0a7ee3 2023-02-07 thomas echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
222 9d0a7ee3 2023-02-07 thomas cmp -s $testroot/stdout $testroot/stdout.expected
224 9d0a7ee3 2023-02-07 thomas if [ $ret -ne 0 ]; then
225 9d0a7ee3 2023-02-07 thomas diff -u $testroot/stdout.expected $testroot/stdout
226 9d0a7ee3 2023-02-07 thomas test_done "$testroot" "$ret"
230 9d0a7ee3 2023-02-07 thomas # fetch branch foo via command-line switch
231 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
233 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/master: $commit_id2" \
258 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
259 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
260 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
262 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
264 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
265 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
270 8d0dceb3 2023-02-07 thomas # got.conf tells us to fetch the 'master' branch by default
271 8d0dceb3 2023-02-07 thomas got fetch -q -r $testroot/repo-clone > $testroot/stdout
273 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
274 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
275 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
279 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
281 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
283 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
284 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
285 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
289 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
291 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
292 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
293 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
294 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
295 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
296 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
297 91b10dd2 2023-02-03 thomas echo "refs/remotes/origin/master: $commit_id2" \
298 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
299 91b10dd2 2023-02-03 thomas # refs/hoo/boo/zoo is missing because it is outside of refs/heads
300 91b10dd2 2023-02-03 thomas echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
302 91b10dd2 2023-02-03 thomas cmp -s $testroot/stdout $testroot/stdout.expected
304 91b10dd2 2023-02-03 thomas if [ $ret -ne 0 ]; then
305 91b10dd2 2023-02-03 thomas diff -u $testroot/stdout.expected $testroot/stdout
306 91b10dd2 2023-02-03 thomas test_done "$testroot" "$ret"
310 91b10dd2 2023-02-03 thomas echo "modified beta on foo" > $testroot/repo/beta
311 91b10dd2 2023-02-03 thomas git_commit $testroot/repo -m "modified beta"
312 91b10dd2 2023-02-03 thomas local commit_id4=`git_show_head $testroot/repo`
314 8d0dceb3 2023-02-07 thomas # set the default HEAD branch back to master
315 8d0dceb3 2023-02-07 thomas (cd $testroot/repo && git checkout -q master)
317 91b10dd2 2023-02-03 thomas got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
319 91b10dd2 2023-02-03 thomas # fetch new commits on branch 'foo', implicitly obtaining the
320 91b10dd2 2023-02-03 thomas # branch name from a work tree
321 91b10dd2 2023-02-03 thomas (cd $testroot/wt && got fetch -q > $testroot/stdout)
323 91b10dd2 2023-02-03 thomas echo -n > $testroot/stdout.expected
325 91b10dd2 2023-02-03 thomas cmp -s $testroot/stdout $testroot/stdout.expected
327 91b10dd2 2023-02-03 thomas if [ $ret -ne 0 ]; then
328 91b10dd2 2023-02-03 thomas diff -u $testroot/stdout.expected $testroot/stdout
329 91b10dd2 2023-02-03 thomas test_done "$testroot" "$ret"
333 91b10dd2 2023-02-03 thomas wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
334 91b10dd2 2023-02-03 thomas cut -d ':' -f 2 | tr -d ' ')`
336 91b10dd2 2023-02-03 thomas got ref -l -r $testroot/repo-clone > $testroot/stdout
338 91b10dd2 2023-02-03 thomas echo "HEAD: refs/heads/master" > $testroot/stdout.expected
339 91b10dd2 2023-02-03 thomas echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
340 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
341 91b10dd2 2023-02-03 thomas echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
342 91b10dd2 2023-02-03 thomas echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
343 8d0dceb3 2023-02-07 thomas echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
344 91b10dd2 2023-02-03 thomas >> $testroot/stdout.expected
345 91b10dd2 2023-02-03 thomas echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
346 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
347 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
348 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
349 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
351 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
353 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
354 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
355 9d0a7ee3 2023-02-07 thomas test_done "$testroot" "$ret"
359 9d0a7ee3 2023-02-07 thomas # remove default branch information from got.conf
360 9d0a7ee3 2023-02-07 thomas sed -i -e "/branch {/d" $testroot/repo-clone/got.conf
362 9d0a7ee3 2023-02-07 thomas # make another change on 'foo' and fetch it without got.conf
363 9d0a7ee3 2023-02-07 thomas (cd $testroot/repo && git checkout -q foo)
364 9d0a7ee3 2023-02-07 thomas echo "modified beta on foo agan" > $testroot/repo/beta
365 9d0a7ee3 2023-02-07 thomas git_commit $testroot/repo -m "modified beta"
366 9d0a7ee3 2023-02-07 thomas local commit_id5=`git_show_head $testroot/repo`
367 9d0a7ee3 2023-02-07 thomas (cd $testroot/repo && git checkout -q master)
369 9d0a7ee3 2023-02-07 thomas # fetch new commits on branch 'foo', implicitly obtaining the
370 9d0a7ee3 2023-02-07 thomas # branch name from a work tree
371 9d0a7ee3 2023-02-07 thomas (cd $testroot/wt && got fetch -q > $testroot/stdout)
373 9d0a7ee3 2023-02-07 thomas echo -n > $testroot/stdout.expected
375 9d0a7ee3 2023-02-07 thomas cmp -s $testroot/stdout $testroot/stdout.expected
377 9d0a7ee3 2023-02-07 thomas if [ $ret -ne 0 ]; then
378 9d0a7ee3 2023-02-07 thomas diff -u $testroot/stdout.expected $testroot/stdout
379 9d0a7ee3 2023-02-07 thomas test_done "$testroot" "$ret"
383 9d0a7ee3 2023-02-07 thomas wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
384 9d0a7ee3 2023-02-07 thomas cut -d ':' -f 2 | tr -d ' ')`
386 9d0a7ee3 2023-02-07 thomas got ref -l -r $testroot/repo-clone > $testroot/stdout
388 9d0a7ee3 2023-02-07 thomas echo "HEAD: refs/heads/master" > $testroot/stdout.expected
389 9d0a7ee3 2023-02-07 thomas echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
390 9d0a7ee3 2023-02-07 thomas >> $testroot/stdout.expected
391 9d0a7ee3 2023-02-07 thomas echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
392 9d0a7ee3 2023-02-07 thomas echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
393 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
394 9d0a7ee3 2023-02-07 thomas >> $testroot/stdout.expected
395 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/foo: $commit_id5" >> $testroot/stdout.expected
396 9d0a7ee3 2023-02-07 thomas echo "refs/remotes/origin/master: $commit_id2" \
397 9d0a7ee3 2023-02-07 thomas >> $testroot/stdout.expected
398 9d0a7ee3 2023-02-07 thomas # refs/hoo/boo/zoo is missing because it is outside of refs/heads
399 9d0a7ee3 2023-02-07 thomas echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
401 9d0a7ee3 2023-02-07 thomas cmp -s $testroot/stdout $testroot/stdout.expected
403 9d0a7ee3 2023-02-07 thomas if [ $ret -ne 0 ]; then
404 9d0a7ee3 2023-02-07 thomas diff -u $testroot/stdout.expected $testroot/stdout
406 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
409 f6cae3ed 2020-09-13 naddy test_fetch_all() {
410 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
411 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
412 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
414 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
416 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
417 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
418 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
422 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
423 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
424 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
425 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
426 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
428 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
430 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
431 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
432 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
433 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
434 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
435 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
436 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
438 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
440 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
441 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
442 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
446 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
448 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
449 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
450 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
454 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
456 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
457 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
458 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
459 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
460 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
461 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
462 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
463 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
464 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
465 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
467 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
469 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
470 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
472 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
475 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
476 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
477 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
478 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
480 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
481 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
482 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
484 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
486 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
487 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
488 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
492 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
493 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
495 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
497 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
498 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
499 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
500 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
501 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
502 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
503 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
504 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
506 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
508 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
509 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
510 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
514 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
516 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
517 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
518 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
522 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
524 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
525 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
526 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
527 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
528 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
529 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
530 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
531 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
532 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
533 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
535 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
537 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
538 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
540 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
543 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
544 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
545 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
546 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
549 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
550 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
551 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
552 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
553 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
555 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
557 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
558 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
559 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
563 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
565 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
566 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
567 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
568 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
569 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
570 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
571 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
572 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
573 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
574 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
575 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
577 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
579 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
580 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
581 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
585 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
587 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
589 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
590 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
591 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
595 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
597 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
598 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
599 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
600 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
601 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
602 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
603 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
604 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
605 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
606 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
608 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
610 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
611 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
612 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
616 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
618 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
619 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
620 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
624 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
626 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
628 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
629 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
630 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
634 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
636 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
637 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
638 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
639 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
640 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
641 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
642 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
643 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
644 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
645 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
647 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
649 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
650 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
652 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
656 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
657 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
658 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
659 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
661 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
662 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
663 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
664 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
665 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
667 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
669 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
670 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
671 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
675 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
677 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
678 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
679 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
680 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
681 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
683 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
685 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
686 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
687 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
691 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
693 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
695 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
696 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
697 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
701 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
703 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
704 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
705 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
706 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
707 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
709 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
711 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
712 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
713 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
717 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
719 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
720 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
721 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
725 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
727 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
729 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
730 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
731 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
735 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
737 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
738 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
739 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
740 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
741 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
743 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
745 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
746 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
748 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
752 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
753 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
754 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
755 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
758 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
759 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
760 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
761 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
762 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
764 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
766 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
767 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
768 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
772 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
773 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
774 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
776 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
777 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
778 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
779 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
781 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
783 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
784 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
785 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
786 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
787 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
788 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
789 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
790 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
791 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
792 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
793 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
795 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
797 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
798 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
799 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
803 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
805 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
806 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
807 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
811 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
813 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
814 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
815 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
816 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
817 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
818 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
819 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
820 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
821 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
822 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
824 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
826 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
827 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
828 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
832 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
833 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
835 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
836 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
837 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
841 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
842 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
844 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
846 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
847 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
848 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
852 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
854 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
855 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
856 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
857 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
858 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
859 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
860 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
861 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
862 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
863 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
865 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
867 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
868 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
869 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
873 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
875 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
876 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
877 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
881 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
883 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
885 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
886 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
887 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
891 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
893 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
894 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
895 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
896 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
897 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
898 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
899 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
900 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
901 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
902 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
904 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
906 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
907 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
909 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
912 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
913 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
914 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
915 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
917 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
919 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
920 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
921 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
925 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
926 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
927 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
928 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
929 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
931 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
932 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
933 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
935 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
936 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
937 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
938 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
939 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
941 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
942 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
944 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
945 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
946 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
950 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
952 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
954 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
955 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
956 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
960 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
961 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
963 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
965 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
966 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
967 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
971 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
973 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
974 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
975 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
979 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
981 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
982 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
983 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
984 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
985 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
986 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
987 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
988 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
989 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
991 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
993 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
994 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
996 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1000 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
1001 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
1002 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
1003 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
1005 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
1007 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1008 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
1009 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1013 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1014 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
1016 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1018 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1019 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1020 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
1022 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1024 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1025 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1026 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1030 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
1031 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
1033 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1034 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
1035 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1039 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
1040 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
1042 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1044 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1045 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1046 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1050 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1052 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1053 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1054 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
1056 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1058 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1059 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1061 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1065 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
1066 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
1067 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
1068 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
1070 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
1072 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1073 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
1074 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1078 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1080 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1081 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1082 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1083 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1084 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1085 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1087 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1089 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1090 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1091 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1095 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1096 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
1097 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
1099 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1100 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1101 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1103 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1105 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1106 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1107 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1111 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
1113 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1115 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1116 15d3c221 2021-01-05 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1117 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1118 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1119 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
1120 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1122 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1124 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1125 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1126 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
1130 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
1132 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1134 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1135 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1136 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1137 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1138 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1139 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
1140 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1141 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1142 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1144 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1146 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1147 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1149 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1152 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1153 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1154 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1155 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1157 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1159 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1160 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1161 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1165 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1167 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1168 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1169 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1170 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1171 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1172 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1174 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1176 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1177 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1178 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1182 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1184 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1186 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1187 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1188 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1191 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1193 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1194 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1195 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1196 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1197 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1198 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1199 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1201 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1203 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1204 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1206 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1209 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1210 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1211 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1212 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1214 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1215 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1216 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1218 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1220 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1221 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1222 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1226 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1227 50b0790e 2020-09-11 stsp remote "foobar" {
1228 50b0790e 2020-09-11 stsp protocol ssh
1229 50b0790e 2020-09-11 stsp server 127.0.0.1
1230 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1233 50b0790e 2020-09-11 stsp remote "barbaz" {
1234 50b0790e 2020-09-11 stsp protocol ssh
1235 50b0790e 2020-09-11 stsp server 127.0.0.1
1236 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
1239 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1240 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1241 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1242 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1244 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1245 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1246 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1247 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1251 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1252 50b0790e 2020-09-11 stsp > $testroot/stdout)
1254 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1255 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1256 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1260 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1262 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1264 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1265 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1266 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1270 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1272 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1273 50b0790e 2020-09-11 stsp remote "barbaz" {
1274 50b0790e 2020-09-11 stsp protocol ssh
1275 50b0790e 2020-09-11 stsp server 127.0.0.1
1276 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1279 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1281 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1282 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1283 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1287 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1289 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1291 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1292 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1293 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1297 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1298 99495ddb 2021-01-10 stsp remote "origin" {
1299 99495ddb 2021-01-10 stsp protocol ssh
1300 99495ddb 2021-01-10 stsp server 127.0.0.1
1301 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1302 99495ddb 2021-01-10 stsp branch { "foo" }
1303 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1306 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1308 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1309 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1310 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1311 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1312 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1313 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1314 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1315 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1316 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1317 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1318 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1319 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1320 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1321 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1323 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1325 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1327 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1328 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1330 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1333 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1334 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1335 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1336 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1338 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1340 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1341 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1342 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1346 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1348 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1349 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1350 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1354 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1355 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1356 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1357 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1358 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1359 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1361 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1363 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1364 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1365 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1369 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1370 161728eb 2021-07-24 stsp 2> $testroot/stderr
1372 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1373 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1374 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1378 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1379 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1381 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1382 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1383 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1387 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1388 161728eb 2021-07-24 stsp 2> $testroot/stderr
1390 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1391 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1392 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1396 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1397 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1398 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1399 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1401 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1403 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1404 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1405 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1409 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1411 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1412 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1413 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1417 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1418 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1420 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1422 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1423 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1425 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1429 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1430 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1431 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1432 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1433 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1434 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1435 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1436 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1437 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1438 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1439 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1440 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1441 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1442 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1443 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs