3 c8c71e6e 2020-03-21 stsp # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 c8c71e6e 2020-03-21 stsp # Permission to use, copy, modify, and distribute this software for any
6 c8c71e6e 2020-03-21 stsp # purpose with or without fee is hereby granted, provided that the above
7 c8c71e6e 2020-03-21 stsp # copyright notice and this permission notice appear in all copies.
9 c8c71e6e 2020-03-21 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c8c71e6e 2020-03-21 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c8c71e6e 2020-03-21 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c8c71e6e 2020-03-21 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c8c71e6e 2020-03-21 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c8c71e6e 2020-03-21 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c8c71e6e 2020-03-21 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c8c71e6e 2020-03-21 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_fetch_basic() {
20 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_basic`
21 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
22 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
24 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
26 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
27 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
28 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
32 c8c71e6e 2020-03-21 stsp echo "modified alpha" > $testroot/repo/alpha
33 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
34 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
36 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
38 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
39 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
40 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
44 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
45 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
47 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
48 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
49 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
53 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
55 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
57 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
58 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
59 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
63 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
65 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
66 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
67 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
70 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
72 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
73 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
74 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
77 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
79 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
80 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
81 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
85 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
87 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
88 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
89 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
93 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
94 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
96 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
98 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
99 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
100 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
104 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
106 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
107 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
108 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
112 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
113 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
114 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
115 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
116 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
117 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
119 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
121 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
122 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
124 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
127 f6cae3ed 2020-09-13 naddy test_fetch_list() {
128 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
129 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
130 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
132 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
133 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
134 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
136 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
138 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
139 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
140 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
144 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l \
145 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
147 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
148 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
149 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
153 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
155 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
157 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
158 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
160 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
163 f6cae3ed 2020-09-13 naddy test_fetch_branch() {
164 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
165 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
166 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
168 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
170 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
171 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
172 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
176 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
177 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
178 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
179 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
180 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
182 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
183 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
184 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
186 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
187 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
188 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
189 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
191 bf1c78e5 2023-02-18 mark # foo is now the default HEAD branch in $testroot/repo and should be
192 bf1c78e5 2023-02-18 mark # fetched as the clone's remote HEAD symref target no longer matches
193 188f8dcf 2023-02-07 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout
195 188f8dcf 2023-02-07 stsp if [ $ret -ne 0 ]; then
196 188f8dcf 2023-02-07 stsp echo "got fetch command failed unexpectedly" >&2
197 188f8dcf 2023-02-07 stsp test_done "$testroot" "$ret"
201 188f8dcf 2023-02-07 stsp echo -n > $testroot/stdout.expected
203 188f8dcf 2023-02-07 stsp cmp -s $testroot/stdout $testroot/stdout.expected
205 188f8dcf 2023-02-07 stsp if [ $ret -ne 0 ]; then
206 188f8dcf 2023-02-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
207 188f8dcf 2023-02-07 stsp test_done "$testroot" "$ret"
211 188f8dcf 2023-02-07 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
213 188f8dcf 2023-02-07 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
214 bf1c78e5 2023-02-18 mark echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
215 188f8dcf 2023-02-07 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
216 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
217 188f8dcf 2023-02-07 stsp >> $testroot/stdout.expected
218 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/foo: $commit_id3" \
219 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
220 188f8dcf 2023-02-07 stsp echo "refs/remotes/origin/master: $commit_id2" \
221 188f8dcf 2023-02-07 stsp >> $testroot/stdout.expected
222 188f8dcf 2023-02-07 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
223 188f8dcf 2023-02-07 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
225 188f8dcf 2023-02-07 stsp cmp -s $testroot/stdout $testroot/stdout.expected
227 188f8dcf 2023-02-07 stsp if [ $ret -ne 0 ]; then
228 188f8dcf 2023-02-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
229 188f8dcf 2023-02-07 stsp test_done "$testroot" "$ret"
233 188f8dcf 2023-02-07 stsp # fetch branch foo via command-line switch
234 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
236 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
237 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
238 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
242 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
244 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
246 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
247 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
248 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
252 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
254 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
255 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
256 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
257 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
258 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
259 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
260 188f8dcf 2023-02-07 stsp echo "refs/remotes/origin/master: $commit_id2" \
261 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
262 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
263 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
265 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
267 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
268 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
269 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
273 ccbbf026 2023-02-06 stsp # got.conf tells us to fetch the 'master' branch by default
274 ccbbf026 2023-02-06 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout
276 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
277 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
278 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
282 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
284 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
286 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
287 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
288 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
292 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
294 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
295 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
296 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
297 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
298 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
299 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
300 0c091d87 2023-02-02 stsp echo "refs/remotes/origin/master: $commit_id2" \
301 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
302 0c091d87 2023-02-02 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
303 0c091d87 2023-02-02 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
305 0c091d87 2023-02-02 stsp cmp -s $testroot/stdout $testroot/stdout.expected
307 0c091d87 2023-02-02 stsp if [ $ret -ne 0 ]; then
308 0c091d87 2023-02-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
309 0c091d87 2023-02-02 stsp test_done "$testroot" "$ret"
313 0c091d87 2023-02-02 stsp echo "modified beta on foo" > $testroot/repo/beta
314 0c091d87 2023-02-02 stsp git_commit $testroot/repo -m "modified beta"
315 0c091d87 2023-02-02 stsp local commit_id4=`git_show_head $testroot/repo`
317 ccbbf026 2023-02-06 stsp # set the default HEAD branch back to master
318 ccbbf026 2023-02-06 stsp (cd $testroot/repo && git checkout -q master)
320 0c091d87 2023-02-02 stsp got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
322 0c091d87 2023-02-02 stsp # fetch new commits on branch 'foo', implicitly obtaining the
323 0c091d87 2023-02-02 stsp # branch name from a work tree
324 0c091d87 2023-02-02 stsp (cd $testroot/wt && got fetch -q > $testroot/stdout)
326 0c091d87 2023-02-02 stsp echo -n > $testroot/stdout.expected
328 0c091d87 2023-02-02 stsp cmp -s $testroot/stdout $testroot/stdout.expected
330 0c091d87 2023-02-02 stsp if [ $ret -ne 0 ]; then
331 0c091d87 2023-02-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
332 0c091d87 2023-02-02 stsp test_done "$testroot" "$ret"
336 0c091d87 2023-02-02 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
337 0c091d87 2023-02-02 stsp cut -d ':' -f 2 | tr -d ' ')`
339 0c091d87 2023-02-02 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
341 0c091d87 2023-02-02 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
342 0c091d87 2023-02-02 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
343 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
344 0c091d87 2023-02-02 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
345 0c091d87 2023-02-02 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
346 ccbbf026 2023-02-06 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
347 0c091d87 2023-02-02 stsp >> $testroot/stdout.expected
348 0c091d87 2023-02-02 stsp echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
349 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
350 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
351 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
352 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
354 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
356 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
357 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
358 188f8dcf 2023-02-07 stsp test_done "$testroot" "$ret"
362 188f8dcf 2023-02-07 stsp # remove default branch information from got.conf
363 885e96df 2023-03-06 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
364 885e96df 2023-03-06 naddy g/branch {/d
368 188f8dcf 2023-02-07 stsp # make another change on 'foo' and fetch it without got.conf
369 188f8dcf 2023-02-07 stsp (cd $testroot/repo && git checkout -q foo)
370 188f8dcf 2023-02-07 stsp echo "modified beta on foo agan" > $testroot/repo/beta
371 188f8dcf 2023-02-07 stsp git_commit $testroot/repo -m "modified beta"
372 188f8dcf 2023-02-07 stsp local commit_id5=`git_show_head $testroot/repo`
373 188f8dcf 2023-02-07 stsp (cd $testroot/repo && git checkout -q master)
375 188f8dcf 2023-02-07 stsp # fetch new commits on branch 'foo', implicitly obtaining the
376 188f8dcf 2023-02-07 stsp # branch name from a work tree
377 188f8dcf 2023-02-07 stsp (cd $testroot/wt && got fetch -q > $testroot/stdout)
379 188f8dcf 2023-02-07 stsp echo -n > $testroot/stdout.expected
381 188f8dcf 2023-02-07 stsp cmp -s $testroot/stdout $testroot/stdout.expected
383 188f8dcf 2023-02-07 stsp if [ $ret -ne 0 ]; then
384 188f8dcf 2023-02-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
385 188f8dcf 2023-02-07 stsp test_done "$testroot" "$ret"
389 188f8dcf 2023-02-07 stsp wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
390 188f8dcf 2023-02-07 stsp cut -d ':' -f 2 | tr -d ' ')`
392 188f8dcf 2023-02-07 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
394 188f8dcf 2023-02-07 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
395 188f8dcf 2023-02-07 stsp echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
396 188f8dcf 2023-02-07 stsp >> $testroot/stdout.expected
397 188f8dcf 2023-02-07 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
398 188f8dcf 2023-02-07 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
399 188f8dcf 2023-02-07 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
400 188f8dcf 2023-02-07 stsp >> $testroot/stdout.expected
401 188f8dcf 2023-02-07 stsp echo "refs/remotes/origin/foo: $commit_id5" >> $testroot/stdout.expected
402 188f8dcf 2023-02-07 stsp echo "refs/remotes/origin/master: $commit_id2" \
403 188f8dcf 2023-02-07 stsp >> $testroot/stdout.expected
404 188f8dcf 2023-02-07 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
405 188f8dcf 2023-02-07 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
407 188f8dcf 2023-02-07 stsp cmp -s $testroot/stdout $testroot/stdout.expected
409 188f8dcf 2023-02-07 stsp if [ $ret -ne 0 ]; then
410 188f8dcf 2023-02-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
412 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
415 f6cae3ed 2020-09-13 naddy test_fetch_all() {
416 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
417 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
418 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
420 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
422 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
423 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
424 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
428 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
429 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
430 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
431 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
432 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
434 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
436 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
437 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
438 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
439 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
440 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
441 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
442 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
444 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
446 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
447 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
448 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
452 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
454 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
455 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
456 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
460 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
462 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
463 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
464 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
465 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
466 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
467 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
468 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
469 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
470 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
471 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
473 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
475 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
476 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
478 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
481 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
482 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
483 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
484 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
486 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
487 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
488 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
490 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
492 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
493 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
494 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
498 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
499 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
501 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
503 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
504 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
505 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
506 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
507 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
508 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
509 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
510 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
512 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
514 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
515 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
516 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
520 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
522 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
523 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
524 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
528 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
530 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
531 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
532 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
533 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
534 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
535 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
536 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
537 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
538 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
539 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
541 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
543 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
544 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
546 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
549 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
550 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
551 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
552 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
555 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
556 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
557 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
558 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
559 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
561 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
563 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
564 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
565 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
569 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
571 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
572 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
573 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
574 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
575 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
576 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
577 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
578 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
579 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
580 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
581 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
583 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
585 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
586 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
587 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
591 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
593 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
595 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
596 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
597 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
601 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
603 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
604 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
605 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
606 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
607 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
608 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
609 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
610 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
611 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
612 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
614 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
616 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
617 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
618 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
622 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
624 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
625 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
626 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
630 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
632 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
634 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
635 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
636 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
640 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
642 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
643 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
644 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
645 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
646 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
647 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
648 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
649 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
650 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
651 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
653 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
655 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
656 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
658 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
662 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
663 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
664 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
665 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
667 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
668 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
669 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
670 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
671 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
673 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
675 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
676 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
677 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
681 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
683 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
684 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
685 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
686 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
687 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
689 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
691 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
692 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
693 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
697 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
699 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
701 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
702 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
703 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
707 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
709 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
710 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
711 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
712 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
713 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
715 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
717 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
718 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
719 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
723 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
725 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
726 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
727 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
731 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
733 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
735 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
736 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
737 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
741 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
743 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
744 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
745 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
746 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
747 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
749 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
751 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
752 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
754 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
758 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
759 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
760 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
761 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
764 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
765 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
766 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
767 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
768 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
770 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
772 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
773 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
774 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
778 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
779 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
780 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
782 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
783 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
784 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
785 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
787 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
789 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
790 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
791 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
792 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
793 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
794 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
795 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
796 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
797 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
798 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
799 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
801 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
803 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
804 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
805 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
809 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
811 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
812 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
813 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
817 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
819 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
820 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
821 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
822 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
823 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
824 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
825 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
826 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
827 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
828 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
830 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
832 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
833 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
834 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
838 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
839 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
841 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
842 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
843 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
847 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
848 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
850 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
852 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
853 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
854 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
858 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
860 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
861 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
862 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
863 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
864 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
865 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
866 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
867 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
868 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
869 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
871 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
873 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
874 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
875 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
879 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
881 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
882 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
883 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
887 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
889 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
891 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
892 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
893 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
897 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
899 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
900 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
901 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
902 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
903 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
904 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
905 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
906 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
907 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
908 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
910 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
912 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
913 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
915 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
918 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
919 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
920 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
921 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
923 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
925 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
926 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
927 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
931 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
932 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
933 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
934 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
935 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
937 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
938 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
939 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
941 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
942 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
943 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
944 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
945 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
947 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
948 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
950 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
951 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
952 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
956 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
958 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
960 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
961 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
962 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
966 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
967 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
969 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
971 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
972 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
973 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
977 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
980 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
981 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
985 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
987 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
988 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
989 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
990 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
991 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
992 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
993 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
994 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
995 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
997 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
999 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1000 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1002 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1006 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
1007 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
1008 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
1009 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
1011 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
1013 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1014 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
1015 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1019 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1020 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
1022 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1024 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1025 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1026 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
1028 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1030 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1031 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1032 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1036 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
1037 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
1039 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1040 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
1041 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1045 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
1046 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
1048 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1050 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1051 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1052 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1056 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1058 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1059 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1060 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
1062 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1064 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1065 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1067 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1071 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
1072 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
1073 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
1074 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
1076 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
1078 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1079 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
1080 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1084 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1086 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1087 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1088 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1089 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1090 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1091 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1093 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1095 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1096 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1097 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1101 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1102 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
1103 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
1105 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1106 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1107 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1109 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1111 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1112 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1113 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1117 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
1119 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1121 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1122 bf1c78e5 2023-02-18 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1123 4bff57b4 2023-02-14 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1124 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1125 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1126 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/foo: $commit_id" \
1127 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1128 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
1129 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1131 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1133 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1134 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1135 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
1139 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
1141 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1143 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1144 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1145 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1146 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1147 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1148 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
1149 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1150 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1151 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1153 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1155 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1156 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1158 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1161 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1162 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1163 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1164 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1166 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1168 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1169 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1170 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1174 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1176 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1177 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1178 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1179 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1180 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1181 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1183 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1185 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1186 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1187 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1191 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1193 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1195 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1196 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1197 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1200 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1202 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1203 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1204 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1205 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1206 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1207 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1208 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1210 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1212 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1213 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1215 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1218 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1219 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1220 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1221 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1223 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1224 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1225 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1227 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1229 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1230 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1231 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1235 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1236 50b0790e 2020-09-11 stsp remote "foobar" {
1237 50b0790e 2020-09-11 stsp protocol ssh
1238 50b0790e 2020-09-11 stsp server 127.0.0.1
1239 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1242 50b0790e 2020-09-11 stsp remote "barbaz" {
1243 50b0790e 2020-09-11 stsp protocol ssh
1244 50b0790e 2020-09-11 stsp server 127.0.0.1
1245 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
1248 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1249 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1250 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1251 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1253 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1254 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1255 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1256 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1260 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1261 50b0790e 2020-09-11 stsp > $testroot/stdout)
1263 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1264 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1265 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1269 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1271 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1274 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1275 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1279 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1281 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1282 50b0790e 2020-09-11 stsp remote "barbaz" {
1283 50b0790e 2020-09-11 stsp protocol ssh
1284 50b0790e 2020-09-11 stsp server 127.0.0.1
1285 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1288 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1290 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1291 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1292 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1296 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1298 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1300 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1301 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1302 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1306 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1307 99495ddb 2021-01-10 stsp remote "origin" {
1308 99495ddb 2021-01-10 stsp protocol ssh
1309 99495ddb 2021-01-10 stsp server 127.0.0.1
1310 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1311 99495ddb 2021-01-10 stsp branch { "foo" }
1312 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1315 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1317 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1318 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1319 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1320 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1321 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1322 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1323 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1324 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1325 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1326 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1327 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1328 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1329 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1330 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1332 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1334 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1336 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1337 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1339 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1342 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1343 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1344 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1345 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1347 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1349 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1350 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1351 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1355 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1357 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1358 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1359 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1363 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1364 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1365 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1366 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1367 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1368 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1370 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1372 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1373 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1374 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1378 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1379 161728eb 2021-07-24 stsp 2> $testroot/stderr
1381 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1382 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1383 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1387 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1388 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1390 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1391 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1392 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1396 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1397 161728eb 2021-07-24 stsp 2> $testroot/stderr
1399 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1400 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1401 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1405 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1406 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1407 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1408 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1410 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1412 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1413 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1414 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1418 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1420 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1421 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1422 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1426 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1427 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1429 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1431 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1432 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1434 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1437 1cb79834 2023-02-13 mark test_fetch_honor_wt_conf_bflag() {
1438 ac51614e 2023-02-15 mark local testroot=`test_init fetch_honor_wt_conf_bflag`
1439 1cb79834 2023-02-13 mark local testurl=ssh://127.0.0.1/$testroot
1441 1cb79834 2023-02-13 mark # server will have 'boo', 'hoo', and 'master'
1442 1cb79834 2023-02-13 mark echo "modified alpha on master" > $testroot/repo/alpha
1443 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha"
1444 1cb79834 2023-02-13 mark local commit_id=`git_show_head $testroot/repo`
1446 1cb79834 2023-02-13 mark got branch -r $testroot/repo -c $commit_id boo
1447 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q boo)
1448 1cb79834 2023-02-13 mark echo "modified beta on boo" > $testroot/repo/beta
1449 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified beta"
1450 1cb79834 2023-02-13 mark local commit_id2=`git_show_head $testroot/repo`
1452 1cb79834 2023-02-13 mark got branch -r $testroot/repo -c $commit_id2 hoo
1453 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q hoo)
1454 1cb79834 2023-02-13 mark echo "modified delta on hoo" > $testroot/repo/gamma/delta
1455 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta"
1456 1cb79834 2023-02-13 mark local commit_id3=`git_show_head $testroot/repo`
1458 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q master)
1459 1cb79834 2023-02-13 mark got clone -q $testurl/repo $testroot/repo-clone
1461 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1462 1cb79834 2023-02-13 mark echo "got clone command failed unexpectedly" >&2
1463 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1467 1cb79834 2023-02-13 mark # only clone will have foo and bar
1468 1cb79834 2023-02-13 mark got branch -r $testroot/repo-clone -c $commit_id foo
1469 1cb79834 2023-02-13 mark got branch -r $testroot/repo-clone -c $commit_id bar
1471 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1473 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1474 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1475 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1479 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1481 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1483 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1484 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1485 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1489 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1491 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1492 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1493 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1494 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1495 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1496 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1497 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id" \
1498 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1500 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1502 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1503 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1504 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1508 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q boo)
1509 bf1c78e5 2023-02-18 mark # clone has remote/origin/HEAD symref with "master" as its target
1510 bf1c78e5 2023-02-18 mark # but the repo has changed HEAD to "boo", so we should fetch "boo"
1511 bf1c78e5 2023-02-18 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1512 bf1c78e5 2023-02-18 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1513 bf1c78e5 2023-02-18 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1514 bf1c78e5 2023-02-18 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1515 bf1c78e5 2023-02-18 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1516 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1517 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1518 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/boo: $commit_id2" \
1519 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1520 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/master: $commit_id" \
1521 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1523 bf1c78e5 2023-02-18 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1525 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1526 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1527 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1531 bf1c78e5 2023-02-18 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1533 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1535 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1536 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1537 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1541 bf1c78e5 2023-02-18 mark # from repo: fetch -b hoo
1542 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone -b hoo > $testroot/stdout
1544 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1545 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1546 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1550 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1552 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1554 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1555 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1556 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1560 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1562 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1563 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1564 bf1c78e5 2023-02-18 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1565 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1566 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1567 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1568 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1569 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1570 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/boo: $commit_id2" \
1571 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1572 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1573 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1574 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1575 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1577 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1579 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1580 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1581 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1585 1cb79834 2023-02-13 mark # from repo: fetch -b foo which doesn't exist on the server but
1586 1cb79834 2023-02-13 mark # do not fallback to repo HEAD "boo" because we used the -b flag
1587 1cb79834 2023-02-13 mark got fetch -r $testroot/repo-clone -b foo > $testroot/stdout \
1588 1cb79834 2023-02-13 mark 2> $testroot/stderr
1590 1cb79834 2023-02-13 mark echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1591 1cb79834 2023-02-13 mark > $testroot/stdout.expected
1592 f72ce919 2023-02-13 mark echo "got-fetch-pack: branch \"foo\" not found on server" \
1593 1cb79834 2023-02-13 mark > $testroot/stderr.expected
1594 1cb79834 2023-02-13 mark echo "got: could not find any branches to fetch" \
1595 1cb79834 2023-02-13 mark >> $testroot/stderr.expected
1597 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1599 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1600 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1601 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1605 1cb79834 2023-02-13 mark cmp -s $testroot/stderr $testroot/stderr.expected
1607 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1608 1cb79834 2023-02-13 mark diff -u $testroot/stderr.expected $testroot/stderr
1609 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1613 4bff57b4 2023-02-14 stsp # from repo: fetch got.conf branch which doesn't exist, so fallback
1614 4bff57b4 2023-02-14 stsp # to repo HEAD "boo"
1615 1cb79834 2023-02-13 mark # change default branch in got.conf from "master" to "foo"
1616 885e96df 2023-03-06 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
1617 885e96df 2023-03-06 naddy ,s/master/foo/
1621 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1623 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1624 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1625 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1629 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1631 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1633 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1634 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1635 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1639 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1641 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1642 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1643 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1644 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1645 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1646 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1647 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1648 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1649 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/boo: $commit_id2" \
1650 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1651 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1652 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1653 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1654 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1656 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1658 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1659 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1660 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1664 4bff57b4 2023-02-14 stsp # from wt: fetch got.conf "foo", which doesn't exist on the server,
1665 4bff57b4 2023-02-14 stsp # and implicit wt branch "boo", not repo HEAD "master"
1666 1cb79834 2023-02-13 mark echo "modified delta on boo" > $testroot/repo/gamma/delta
1667 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta"
1668 1cb79834 2023-02-13 mark local commit_id4=`git_show_head $testroot/repo`
1670 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q master)
1672 1cb79834 2023-02-13 mark got checkout -b boo $testroot/repo-clone $testroot/wt > /dev/null
1673 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q > $testroot/stdout)
1675 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1677 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1679 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1680 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1681 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1685 1cb79834 2023-02-13 mark local wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1686 1cb79834 2023-02-13 mark cut -d ':' -f 2 | tr -d ' ')`
1688 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1690 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1691 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1692 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1693 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1694 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1695 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1696 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1697 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1698 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1699 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1700 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id4" \
1701 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1702 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1703 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1704 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1705 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1707 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1709 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1710 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1711 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1715 bf1c78e5 2023-02-18 mark # from wt: fetch got.conf "master", wt "boo", and the repo's new HEAD
1716 bf1c78e5 2023-02-18 mark # "hoo" as it no longer matches our remote HEAD symref target "master"
1717 885e96df 2023-03-06 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
1718 885e96df 2023-03-06 naddy ,s/foo/master/
1721 1cb79834 2023-02-13 mark echo "modified delta on master" > $testroot/repo/gamma/delta
1722 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta on master"
1723 1cb79834 2023-02-13 mark local commit_id5=`git_show_head $testroot/repo`
1725 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q boo)
1726 1cb79834 2023-02-13 mark echo "modified alpha on boo" > $testroot/repo/alpha
1727 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha on boo"
1728 1cb79834 2023-02-13 mark local commit_id6=`git_show_head $testroot/repo`
1730 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q hoo)
1731 1cb79834 2023-02-13 mark echo "modified beta on hoo" > $testroot/repo/beta
1732 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified beta on hoo"
1733 1cb79834 2023-02-13 mark local commit_id7=`git_show_head $testroot/repo`
1735 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q > $testroot/stdout)
1737 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1739 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1741 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1742 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1743 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1747 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1749 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1750 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1751 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1752 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1753 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1754 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1755 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1756 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1757 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/hoo" \
1758 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1759 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id6" \
1760 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1761 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/hoo: $commit_id7" \
1762 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1763 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id5" \
1764 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1766 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1768 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1769 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1770 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1774 1cb79834 2023-02-13 mark # from wt: fetch -b hoo not got.conf "master" or wt "boo" or
1775 1cb79834 2023-02-13 mark # repo HEAD "boo"
1776 1cb79834 2023-02-13 mark (cd $testroot/repo && git checkout -q boo)
1777 1cb79834 2023-02-13 mark echo "modified alpha again on boo" > $testroot/repo/alpha
1778 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha again on boo"
1779 1cb79834 2023-02-13 mark local commit_id8=`git_show_head $testroot/repo`
1781 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q -b hoo > $testroot/stdout)
1783 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1785 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1787 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1788 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1789 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1793 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1795 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1796 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1797 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1798 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1799 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1800 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1801 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1802 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1803 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1804 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1805 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id6" \
1806 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1807 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/hoo: $commit_id7" \
1808 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1809 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id5" \
1810 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1812 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1814 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1815 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1816 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1820 1cb79834 2023-02-13 mark # from wt: fetch -b bar that doesn't exist on the server but
1821 1cb79834 2023-02-13 mark # do not fetch got.conf "master" or wt "boo" or repo HEAD "boo"
1822 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -b bar > $testroot/stdout \
1823 1cb79834 2023-02-13 mark 2> $testroot/stderr)
1825 1cb79834 2023-02-13 mark echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1826 1cb79834 2023-02-13 mark > $testroot/stdout.expected
1827 f72ce919 2023-02-13 mark echo "got-fetch-pack: branch \"bar\" not found on server" \
1828 1cb79834 2023-02-13 mark > $testroot/stderr.expected
1829 1cb79834 2023-02-13 mark echo "got: could not find any branches to fetch" \
1830 1cb79834 2023-02-13 mark >> $testroot/stderr.expected
1832 1cb79834 2023-02-13 mark cmp -s $testroot/stderr $testroot/stderr.expected
1834 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1835 1cb79834 2023-02-13 mark diff -u $testroot/stderr.expected $testroot/stderr
1836 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1840 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1842 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1843 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1845 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1848 1a0d06a3 2023-02-20 stsp test_fetch_from_out_of_date_remote() {
1849 1a0d06a3 2023-02-20 stsp local testroot=`test_init fetch_from_out_of_date_remote`
1850 1a0d06a3 2023-02-20 stsp local testurl=ssh://127.0.0.1/$testroot
1851 1a0d06a3 2023-02-20 stsp local commit_id=`git_show_head $testroot/repo`
1853 1a0d06a3 2023-02-20 stsp got clone -q $testurl/repo $testroot/repo-clone
1855 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1856 1a0d06a3 2023-02-20 stsp echo "got clone command failed unexpectedly" >&2
1857 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1861 1a0d06a3 2023-02-20 stsp echo "modified alpha" > $testroot/repo/alpha
1862 1a0d06a3 2023-02-20 stsp git_commit $testroot/repo -m "modified alpha"
1863 1a0d06a3 2023-02-20 stsp local commit_id2=`git_show_head $testroot/repo`
1865 1a0d06a3 2023-02-20 stsp got clone -q $testurl/repo $testroot/repo-clone2 \
1866 1a0d06a3 2023-02-20 stsp > $testroot/stdout 2> $testroot/stderr
1868 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1869 1a0d06a3 2023-02-20 stsp echo "got clone command failed unexpectedly" >&2
1870 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1874 1a0d06a3 2023-02-20 stsp got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1876 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1877 1a0d06a3 2023-02-20 stsp echo "got ref command failed unexpectedly" >&2
1878 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1882 1a0d06a3 2023-02-20 stsp cat > $testroot/stdout.expected <<EOF
1883 1a0d06a3 2023-02-20 stsp HEAD: refs/heads/master
1884 1a0d06a3 2023-02-20 stsp refs/heads/master: $commit_id2
1885 1a0d06a3 2023-02-20 stsp refs/remotes/origin/HEAD: refs/remotes/origin/master
1886 1a0d06a3 2023-02-20 stsp refs/remotes/origin/master: $commit_id2
1888 1a0d06a3 2023-02-20 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1890 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1891 1a0d06a3 2023-02-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
1892 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1896 1a0d06a3 2023-02-20 stsp cat >> $testroot/repo-clone2/got.conf <<EOF
1897 1a0d06a3 2023-02-20 stsp remote "other" {
1898 1a0d06a3 2023-02-20 stsp server "127.0.0.1"
1899 1a0d06a3 2023-02-20 stsp protocol ssh
1900 1a0d06a3 2023-02-20 stsp repository "$testroot/repo-clone"
1901 1a0d06a3 2023-02-20 stsp branch { "master" }
1904 1a0d06a3 2023-02-20 stsp got fetch -q -r $testroot/repo-clone2 other \
1905 1a0d06a3 2023-02-20 stsp > $testroot/stdout 2> $testroot/stderr
1907 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1908 1a0d06a3 2023-02-20 stsp echo "got fetch command failed unexpectedly" >&2
1909 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1913 1a0d06a3 2023-02-20 stsp got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1915 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1916 1a0d06a3 2023-02-20 stsp echo "got ref command failed unexpectedly" >&2
1917 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1921 1a0d06a3 2023-02-20 stsp cat > $testroot/stdout.expected <<EOF
1922 1a0d06a3 2023-02-20 stsp HEAD: refs/heads/master
1923 1a0d06a3 2023-02-20 stsp refs/heads/master: $commit_id2
1924 1a0d06a3 2023-02-20 stsp refs/remotes/origin/HEAD: refs/remotes/origin/master
1925 1a0d06a3 2023-02-20 stsp refs/remotes/origin/master: $commit_id2
1926 1a0d06a3 2023-02-20 stsp refs/remotes/other/HEAD: refs/remotes/other/master
1927 1a0d06a3 2023-02-20 stsp refs/remotes/other/master: $commit_id
1929 1a0d06a3 2023-02-20 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1931 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1932 1a0d06a3 2023-02-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
1934 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1938 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1939 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1940 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1941 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1942 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1943 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1944 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1945 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1946 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1947 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1948 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1949 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1950 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1951 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1952 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs
1953 1cb79834 2023-02-13 mark run_test test_fetch_honor_wt_conf_bflag
1954 1a0d06a3 2023-02-20 stsp run_test test_fetch_from_out_of_date_remote