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 f73bf5bd 2023-10-01 naddy git -C $testroot/repo 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 f73bf5bd 2023-10-01 naddy git -C $testroot/repo 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 f73bf5bd 2023-10-01 naddy git -C $testroot/repo 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 f73bf5bd 2023-10-01 naddy git -C $testroot/repo 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 ref -l -r $testroot/repo-clone > $testroot/stdout
430 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
431 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
432 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
433 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
434 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
435 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
437 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
439 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
440 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
441 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
445 1ef7649d 2023-09-30 naddy got branch -r $testroot/repo -c $commit_id foo
446 1ef7649d 2023-09-30 naddy got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
447 1ef7649d 2023-09-30 naddy got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
448 1ef7649d 2023-09-30 naddy local tag_id=`got ref -r $testroot/repo -l \
449 1ef7649d 2023-09-30 naddy | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
451 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
453 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
454 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
455 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
459 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
461 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
462 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
463 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
464 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
465 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
466 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
467 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
468 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
469 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
470 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
472 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
474 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
475 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
478 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q foo
479 10772348 2023-10-01 naddy echo "modified beta on foo" > $testroot/repo/beta
480 10772348 2023-10-01 naddy git_commit $testroot/repo -m "modified beta"
481 10772348 2023-10-01 naddy local commit_id2=`git_show_head $testroot/repo`
483 10772348 2023-10-01 naddy # set the default HEAD branch back to master
484 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
486 10772348 2023-10-01 naddy # remove default branch from got.conf, fetch all branches
487 10772348 2023-10-01 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
488 10772348 2023-10-01 naddy /branch {/c
489 10772348 2023-10-01 naddy fetch_all_branches yes
494 10772348 2023-10-01 naddy got fetch -q -r $testroot/repo-clone
496 10772348 2023-10-01 naddy if [ $ret -ne 0 ]; then
497 10772348 2023-10-01 naddy echo "got fetch command failed unexpectedly" >&2
498 10772348 2023-10-01 naddy test_done "$testroot" "$ret"
502 10772348 2023-10-01 naddy got ref -l -r $testroot/repo-clone > $testroot/stdout
504 10772348 2023-10-01 naddy echo "HEAD: refs/heads/master" > $testroot/stdout.expected
505 10772348 2023-10-01 naddy echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
506 10772348 2023-10-01 naddy echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
507 10772348 2023-10-01 naddy echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
508 10772348 2023-10-01 naddy >> $testroot/stdout.expected
509 10772348 2023-10-01 naddy echo "refs/remotes/origin/foo: $commit_id2" >> $testroot/stdout.expected
510 10772348 2023-10-01 naddy echo "refs/remotes/origin/master: $commit_id" \
511 10772348 2023-10-01 naddy >> $testroot/stdout.expected
512 10772348 2023-10-01 naddy # refs/hoo/boo/zoo is missing because it is outside of refs/heads
513 10772348 2023-10-01 naddy echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
515 10772348 2023-10-01 naddy cmp -s $testroot/stdout $testroot/stdout.expected
517 10772348 2023-10-01 naddy if [ $ret -ne 0 ]; then
518 10772348 2023-10-01 naddy diff -u $testroot/stdout.expected $testroot/stdout
520 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
523 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
524 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
525 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
526 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
528 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
529 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
530 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
532 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
534 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
535 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
536 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
540 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
541 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
543 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
545 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
546 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
547 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
548 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
549 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
550 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
551 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
552 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
554 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
557 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
558 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
562 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
564 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
565 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
566 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
570 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
572 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
573 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
574 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
575 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
576 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
577 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $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
588 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
591 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
592 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
593 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
594 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
597 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
598 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
599 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
600 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
601 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
603 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
605 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
606 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
607 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
611 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
613 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
614 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
615 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
616 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
617 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
618 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
619 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
620 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
621 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
622 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
623 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
625 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
627 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
628 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
629 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
633 978a28a1 2021-09-04 naddy got branch -r $testroot/repo -d foo >/dev/null
635 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
638 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
639 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
643 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
645 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
646 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
647 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
648 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
649 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
650 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
651 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
652 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
653 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
654 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
656 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
658 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
659 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
660 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
664 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
666 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
667 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
668 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
672 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
674 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
676 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
677 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
678 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
682 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
684 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
685 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
686 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
687 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
688 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
689 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
690 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
691 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
692 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
693 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
695 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
697 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
698 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
700 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
704 1b796c3f 2021-09-11 stsp test_fetch_delete_branch_mirror() {
705 1b796c3f 2021-09-11 stsp local testroot=`test_init fetch_delete_branch_mirror`
706 1b796c3f 2021-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
707 1b796c3f 2021-09-11 stsp local commit_id=`git_show_head $testroot/repo`
709 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
710 1b796c3f 2021-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
711 1b796c3f 2021-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
712 1b796c3f 2021-09-11 stsp local tag_id=`got ref -r $testroot/repo -l \
713 1b796c3f 2021-09-11 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
715 1b796c3f 2021-09-11 stsp got clone -a -m -q $testurl/repo $testroot/repo-clone
717 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
718 1b796c3f 2021-09-11 stsp echo "got clone command failed unexpectedly" >&2
719 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
723 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
725 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
726 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
727 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
728 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
729 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
731 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
733 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
734 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
735 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
739 1b796c3f 2021-09-11 stsp got branch -r $testroot/repo -d foo >/dev/null
741 1b796c3f 2021-09-11 stsp got fetch -q -r $testroot/repo-clone
743 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
744 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
745 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
749 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
751 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
752 1b796c3f 2021-09-11 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
753 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
754 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
755 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
757 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
759 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
760 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
761 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
765 1b796c3f 2021-09-11 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
767 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
768 1b796c3f 2021-09-11 stsp echo "got fetch command failed unexpectedly" >&2
769 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
773 1b796c3f 2021-09-11 stsp echo -n > $testroot/stdout.expected
775 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
777 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
778 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
779 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
783 1b796c3f 2021-09-11 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
785 1b796c3f 2021-09-11 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
786 1b796c3f 2021-09-11 stsp # refs/heads/foo is now deleted
787 1b796c3f 2021-09-11 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
788 1b796c3f 2021-09-11 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
789 1b796c3f 2021-09-11 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
791 1b796c3f 2021-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
793 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
794 1b796c3f 2021-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
796 1b796c3f 2021-09-11 stsp test_done "$testroot" "$ret"
800 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
801 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
802 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
803 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
806 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
807 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
808 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
809 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
810 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
812 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
814 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
815 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
816 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
820 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
821 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
822 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
824 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
825 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
826 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
827 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
829 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
831 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
832 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
833 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
834 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
835 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
836 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
837 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
838 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
839 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
840 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
841 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
843 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
845 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
846 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
847 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
851 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
854 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
855 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
859 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
861 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
862 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
863 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
864 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
865 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
866 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
867 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
868 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
869 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
870 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
872 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
874 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
875 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
876 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
880 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
881 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
883 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
884 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
885 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
889 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
890 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
892 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
894 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
895 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
896 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
900 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
902 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
903 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
904 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
905 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
906 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
907 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
908 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
909 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
910 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
911 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
913 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
915 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
916 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
917 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
921 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
923 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
924 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
925 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
929 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
931 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
933 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
934 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
935 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
939 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
941 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
942 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
943 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
944 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
945 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
946 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
947 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
948 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
949 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
950 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
952 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
954 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
955 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
957 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
960 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
961 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
962 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
963 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
965 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
967 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
968 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
969 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
973 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
974 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
975 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
976 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
977 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
979 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
980 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
981 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
983 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q foo
984 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
985 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
986 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
987 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
989 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
990 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
992 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
993 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
994 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
998 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
1000 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1002 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1003 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1004 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1008 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
1009 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
1011 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1013 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1014 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
1015 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1019 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
1021 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1022 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
1023 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1027 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1029 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1030 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1031 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1032 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
1033 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1034 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
1035 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
1036 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
1037 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1039 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1041 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1042 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1044 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1048 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
1049 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
1050 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
1051 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
1053 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
1055 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1056 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
1057 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1061 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1062 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
1064 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1066 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1067 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1068 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
1070 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1072 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1073 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1074 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1078 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
1079 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
1081 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1082 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
1083 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1087 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
1088 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
1090 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1092 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1093 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1094 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
1098 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1100 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1101 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1102 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
1104 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1106 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1107 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1109 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1113 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
1114 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
1115 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
1116 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
1118 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
1120 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1121 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
1122 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1126 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1128 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1129 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1130 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1131 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1132 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1133 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1135 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1137 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1138 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1139 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1143 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1144 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
1145 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
1147 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1148 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1149 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1151 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1153 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1154 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
1155 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
1159 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
1161 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1163 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1164 bf1c78e5 2023-02-18 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1165 4bff57b4 2023-02-14 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1166 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1167 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1168 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/foo: $commit_id" \
1169 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1170 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
1171 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
1173 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1175 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1176 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1177 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
1181 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
1183 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1185 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1186 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1187 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1188 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1189 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1190 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
1191 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1192 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
1193 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
1195 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1197 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1198 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1200 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
1203 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
1204 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
1205 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
1206 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
1208 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
1210 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1211 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
1212 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1216 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1218 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1219 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1220 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1221 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1222 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1223 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1225 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1227 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1228 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1229 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1233 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1235 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
1237 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1238 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
1239 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
1242 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1244 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1245 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1246 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
1247 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1248 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1249 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
1250 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
1252 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1254 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1255 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1257 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1260 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
1261 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
1262 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
1263 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
1265 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
1266 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1267 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1269 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
1271 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1272 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
1273 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1277 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
1278 50b0790e 2020-09-11 stsp remote "foobar" {
1279 50b0790e 2020-09-11 stsp protocol ssh
1280 50b0790e 2020-09-11 stsp server 127.0.0.1
1281 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1284 50b0790e 2020-09-11 stsp remote "barbaz" {
1285 50b0790e 2020-09-11 stsp protocol ssh
1286 50b0790e 2020-09-11 stsp server 127.0.0.1
1287 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
1290 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1291 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1292 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1293 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1295 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1296 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1297 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1298 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1302 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1303 50b0790e 2020-09-11 stsp > $testroot/stdout)
1305 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1306 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1307 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1311 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1313 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1315 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1316 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1317 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1321 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1323 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1324 50b0790e 2020-09-11 stsp remote "barbaz" {
1325 50b0790e 2020-09-11 stsp protocol ssh
1326 50b0790e 2020-09-11 stsp server 127.0.0.1
1327 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1330 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1332 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1333 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1334 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1338 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1340 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1342 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1343 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1344 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1348 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1349 99495ddb 2021-01-10 stsp remote "origin" {
1350 99495ddb 2021-01-10 stsp protocol ssh
1351 99495ddb 2021-01-10 stsp server 127.0.0.1
1352 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1353 99495ddb 2021-01-10 stsp branch { "foo" }
1354 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1357 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1359 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1360 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1361 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1362 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1363 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1364 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1365 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1366 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1367 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1368 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1369 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1370 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1371 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1372 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1374 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1376 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1378 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1379 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1381 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1384 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1385 678d8c1f 2021-09-10 stsp local testroot=`test_init fetch_delete_remote_refs`
1386 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1387 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1389 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1391 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1392 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1393 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1397 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1399 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1400 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1401 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1405 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1406 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1407 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1408 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1409 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1410 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1412 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1414 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1415 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1416 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1420 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1421 161728eb 2021-07-24 stsp 2> $testroot/stderr
1423 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1424 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1425 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
1429 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1430 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1432 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1433 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1434 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1438 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1439 161728eb 2021-07-24 stsp 2> $testroot/stderr
1441 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1442 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1443 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1447 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1448 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1449 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1450 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1452 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1454 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1455 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1456 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1460 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1462 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1463 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1464 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1468 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1469 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1471 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1473 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1474 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1476 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1479 1cb79834 2023-02-13 mark test_fetch_honor_wt_conf_bflag() {
1480 ac51614e 2023-02-15 mark local testroot=`test_init fetch_honor_wt_conf_bflag`
1481 1cb79834 2023-02-13 mark local testurl=ssh://127.0.0.1/$testroot
1483 1cb79834 2023-02-13 mark # server will have 'boo', 'hoo', and 'master'
1484 1cb79834 2023-02-13 mark echo "modified alpha on master" > $testroot/repo/alpha
1485 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha"
1486 1cb79834 2023-02-13 mark local commit_id=`git_show_head $testroot/repo`
1488 1cb79834 2023-02-13 mark got branch -r $testroot/repo -c $commit_id boo
1489 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q boo
1490 1cb79834 2023-02-13 mark echo "modified beta on boo" > $testroot/repo/beta
1491 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified beta"
1492 1cb79834 2023-02-13 mark local commit_id2=`git_show_head $testroot/repo`
1494 1cb79834 2023-02-13 mark got branch -r $testroot/repo -c $commit_id2 hoo
1495 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q hoo
1496 1cb79834 2023-02-13 mark echo "modified delta on hoo" > $testroot/repo/gamma/delta
1497 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta"
1498 1cb79834 2023-02-13 mark local commit_id3=`git_show_head $testroot/repo`
1500 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1501 1cb79834 2023-02-13 mark got clone -q $testurl/repo $testroot/repo-clone
1503 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1504 1cb79834 2023-02-13 mark echo "got clone command failed unexpectedly" >&2
1505 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1509 1cb79834 2023-02-13 mark # only clone will have foo and bar
1510 1cb79834 2023-02-13 mark got branch -r $testroot/repo-clone -c $commit_id foo
1511 1cb79834 2023-02-13 mark got branch -r $testroot/repo-clone -c $commit_id bar
1513 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1515 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1516 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1517 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1521 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1523 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1525 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1526 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1527 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1531 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1533 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1534 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1535 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1536 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1537 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1538 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1539 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id" \
1540 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1542 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1544 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1545 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1546 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1550 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q boo
1551 bf1c78e5 2023-02-18 mark # clone has remote/origin/HEAD symref with "master" as its target
1552 bf1c78e5 2023-02-18 mark # but the repo has changed HEAD to "boo", so we should fetch "boo"
1553 bf1c78e5 2023-02-18 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1554 bf1c78e5 2023-02-18 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1555 bf1c78e5 2023-02-18 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1556 bf1c78e5 2023-02-18 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1557 bf1c78e5 2023-02-18 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1558 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1559 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1560 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/boo: $commit_id2" \
1561 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1562 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/master: $commit_id" \
1563 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1565 bf1c78e5 2023-02-18 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1567 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1568 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1569 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1573 bf1c78e5 2023-02-18 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1575 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1577 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1578 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1579 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1583 bf1c78e5 2023-02-18 mark # from repo: fetch -b hoo
1584 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone -b hoo > $testroot/stdout
1586 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1587 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1588 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1592 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1594 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1596 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1597 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1598 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1602 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1604 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1605 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1606 bf1c78e5 2023-02-18 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1607 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1608 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1609 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1610 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1611 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1612 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/boo: $commit_id2" \
1613 bf1c78e5 2023-02-18 mark >> $testroot/stdout.expected
1614 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1615 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1616 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1617 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1619 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1621 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1622 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1623 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1627 1cb79834 2023-02-13 mark # from repo: fetch -b foo which doesn't exist on the server but
1628 1cb79834 2023-02-13 mark # do not fallback to repo HEAD "boo" because we used the -b flag
1629 1cb79834 2023-02-13 mark got fetch -r $testroot/repo-clone -b foo > $testroot/stdout \
1630 1cb79834 2023-02-13 mark 2> $testroot/stderr
1632 1cb79834 2023-02-13 mark echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1633 1cb79834 2023-02-13 mark > $testroot/stdout.expected
1634 f72ce919 2023-02-13 mark echo "got-fetch-pack: branch \"foo\" not found on server" \
1635 1cb79834 2023-02-13 mark > $testroot/stderr.expected
1636 1cb79834 2023-02-13 mark echo "got: could not find any branches to fetch" \
1637 1cb79834 2023-02-13 mark >> $testroot/stderr.expected
1639 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1641 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1642 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1643 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1647 1cb79834 2023-02-13 mark cmp -s $testroot/stderr $testroot/stderr.expected
1649 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1650 1cb79834 2023-02-13 mark diff -u $testroot/stderr.expected $testroot/stderr
1651 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1655 4bff57b4 2023-02-14 stsp # from repo: fetch got.conf branch which doesn't exist, so fallback
1656 4bff57b4 2023-02-14 stsp # to repo HEAD "boo"
1657 1cb79834 2023-02-13 mark # change default branch in got.conf from "master" to "foo"
1658 885e96df 2023-03-06 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
1659 885e96df 2023-03-06 naddy ,s/master/foo/
1663 1cb79834 2023-02-13 mark got fetch -q -r $testroot/repo-clone > $testroot/stdout
1665 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1666 1cb79834 2023-02-13 mark echo "got fetch command failed unexpectedly" >&2
1667 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1671 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1673 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1675 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1676 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1677 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1681 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1683 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1684 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1685 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1686 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1687 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1688 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1689 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1690 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1691 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/boo: $commit_id2" \
1692 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1693 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1694 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1695 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1696 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1698 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1700 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1701 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1702 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1706 4bff57b4 2023-02-14 stsp # from wt: fetch got.conf "foo", which doesn't exist on the server,
1707 4bff57b4 2023-02-14 stsp # and implicit wt branch "boo", not repo HEAD "master"
1708 1cb79834 2023-02-13 mark echo "modified delta on boo" > $testroot/repo/gamma/delta
1709 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta"
1710 1cb79834 2023-02-13 mark local commit_id4=`git_show_head $testroot/repo`
1712 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1714 1cb79834 2023-02-13 mark got checkout -b boo $testroot/repo-clone $testroot/wt > /dev/null
1715 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q > $testroot/stdout)
1717 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1719 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1721 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1722 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1723 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1727 1cb79834 2023-02-13 mark local wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1728 1cb79834 2023-02-13 mark cut -d ':' -f 2 | tr -d ' ')`
1730 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1732 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1733 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1734 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1735 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1736 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1737 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1738 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1739 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1740 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1741 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1742 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id4" \
1743 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1744 1cb79834 2023-02-13 mark echo "refs/remotes/origin/hoo: $commit_id3" \
1745 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1746 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/master: $commit_id" \
1747 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1749 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1751 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1752 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1753 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1757 bf1c78e5 2023-02-18 mark # from wt: fetch got.conf "master", wt "boo", and the repo's new HEAD
1758 bf1c78e5 2023-02-18 mark # "hoo" as it no longer matches our remote HEAD symref target "master"
1759 885e96df 2023-03-06 naddy ed -s $testroot/repo-clone/got.conf <<-EOF
1760 885e96df 2023-03-06 naddy ,s/foo/master/
1763 1cb79834 2023-02-13 mark echo "modified delta on master" > $testroot/repo/gamma/delta
1764 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified delta on master"
1765 1cb79834 2023-02-13 mark local commit_id5=`git_show_head $testroot/repo`
1767 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q boo
1768 1cb79834 2023-02-13 mark echo "modified alpha on boo" > $testroot/repo/alpha
1769 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha on boo"
1770 1cb79834 2023-02-13 mark local commit_id6=`git_show_head $testroot/repo`
1772 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q hoo
1773 1cb79834 2023-02-13 mark echo "modified beta on hoo" > $testroot/repo/beta
1774 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified beta on hoo"
1775 1cb79834 2023-02-13 mark local commit_id7=`git_show_head $testroot/repo`
1777 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q > $testroot/stdout)
1779 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1781 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1783 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1784 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1785 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1789 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1791 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1792 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1793 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1794 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1795 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1796 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1797 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1798 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1799 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/hoo" \
1800 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1801 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id6" \
1802 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1803 bf1c78e5 2023-02-18 mark echo "refs/remotes/origin/hoo: $commit_id7" \
1804 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1805 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id5" \
1806 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1808 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1810 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1811 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1812 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1816 1cb79834 2023-02-13 mark # from wt: fetch -b hoo not got.conf "master" or wt "boo" or
1817 1cb79834 2023-02-13 mark # repo HEAD "boo"
1818 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q boo
1819 1cb79834 2023-02-13 mark echo "modified alpha again on boo" > $testroot/repo/alpha
1820 1cb79834 2023-02-13 mark git_commit $testroot/repo -m "modified alpha again on boo"
1821 1cb79834 2023-02-13 mark local commit_id8=`git_show_head $testroot/repo`
1823 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -q -b hoo > $testroot/stdout)
1825 1cb79834 2023-02-13 mark echo -n > $testroot/stdout.expected
1827 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1829 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1830 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1831 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1835 1cb79834 2023-02-13 mark got ref -l -r $testroot/repo-clone > $testroot/stdout
1837 1cb79834 2023-02-13 mark echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1838 1cb79834 2023-02-13 mark echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1839 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1840 1cb79834 2023-02-13 mark echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1841 1cb79834 2023-02-13 mark echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1842 1cb79834 2023-02-13 mark echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1843 1cb79834 2023-02-13 mark echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1844 1cb79834 2023-02-13 mark echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1845 1cb79834 2023-02-13 mark echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1846 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1847 1cb79834 2023-02-13 mark echo "refs/remotes/origin/boo: $commit_id6" \
1848 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1849 4bff57b4 2023-02-14 stsp echo "refs/remotes/origin/hoo: $commit_id7" \
1850 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1851 1cb79834 2023-02-13 mark echo "refs/remotes/origin/master: $commit_id5" \
1852 1cb79834 2023-02-13 mark >> $testroot/stdout.expected
1854 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1856 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1857 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1858 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1862 1cb79834 2023-02-13 mark # from wt: fetch -b bar that doesn't exist on the server but
1863 1cb79834 2023-02-13 mark # do not fetch got.conf "master" or wt "boo" or repo HEAD "boo"
1864 1cb79834 2023-02-13 mark (cd $testroot/wt && got fetch -b bar > $testroot/stdout \
1865 1cb79834 2023-02-13 mark 2> $testroot/stderr)
1867 1cb79834 2023-02-13 mark echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1868 1cb79834 2023-02-13 mark > $testroot/stdout.expected
1869 f72ce919 2023-02-13 mark echo "got-fetch-pack: branch \"bar\" not found on server" \
1870 1cb79834 2023-02-13 mark > $testroot/stderr.expected
1871 1cb79834 2023-02-13 mark echo "got: could not find any branches to fetch" \
1872 1cb79834 2023-02-13 mark >> $testroot/stderr.expected
1874 1cb79834 2023-02-13 mark cmp -s $testroot/stderr $testroot/stderr.expected
1876 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1877 1cb79834 2023-02-13 mark diff -u $testroot/stderr.expected $testroot/stderr
1878 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1882 1cb79834 2023-02-13 mark cmp -s $testroot/stdout $testroot/stdout.expected
1884 1cb79834 2023-02-13 mark if [ $ret -ne 0 ]; then
1885 1cb79834 2023-02-13 mark diff -u $testroot/stdout.expected $testroot/stdout
1887 1cb79834 2023-02-13 mark test_done "$testroot" "$ret"
1890 1a0d06a3 2023-02-20 stsp test_fetch_from_out_of_date_remote() {
1891 1a0d06a3 2023-02-20 stsp local testroot=`test_init fetch_from_out_of_date_remote`
1892 1a0d06a3 2023-02-20 stsp local testurl=ssh://127.0.0.1/$testroot
1893 1a0d06a3 2023-02-20 stsp local commit_id=`git_show_head $testroot/repo`
1895 1a0d06a3 2023-02-20 stsp got clone -q $testurl/repo $testroot/repo-clone
1897 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1898 1a0d06a3 2023-02-20 stsp echo "got clone command failed unexpectedly" >&2
1899 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1903 1a0d06a3 2023-02-20 stsp echo "modified alpha" > $testroot/repo/alpha
1904 1a0d06a3 2023-02-20 stsp git_commit $testroot/repo -m "modified alpha"
1905 1a0d06a3 2023-02-20 stsp local commit_id2=`git_show_head $testroot/repo`
1907 1a0d06a3 2023-02-20 stsp got clone -q $testurl/repo $testroot/repo-clone2 \
1908 1a0d06a3 2023-02-20 stsp > $testroot/stdout 2> $testroot/stderr
1910 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1911 1a0d06a3 2023-02-20 stsp echo "got clone command failed unexpectedly" >&2
1912 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1916 1a0d06a3 2023-02-20 stsp got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1918 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1919 1a0d06a3 2023-02-20 stsp echo "got ref command failed unexpectedly" >&2
1920 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1924 1a0d06a3 2023-02-20 stsp cat > $testroot/stdout.expected <<EOF
1925 1a0d06a3 2023-02-20 stsp HEAD: refs/heads/master
1926 1a0d06a3 2023-02-20 stsp refs/heads/master: $commit_id2
1927 1a0d06a3 2023-02-20 stsp refs/remotes/origin/HEAD: refs/remotes/origin/master
1928 1a0d06a3 2023-02-20 stsp refs/remotes/origin/master: $commit_id2
1930 1a0d06a3 2023-02-20 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1932 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1933 1a0d06a3 2023-02-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
1934 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1938 1a0d06a3 2023-02-20 stsp cat >> $testroot/repo-clone2/got.conf <<EOF
1939 1a0d06a3 2023-02-20 stsp remote "other" {
1940 1a0d06a3 2023-02-20 stsp server "127.0.0.1"
1941 1a0d06a3 2023-02-20 stsp protocol ssh
1942 1a0d06a3 2023-02-20 stsp repository "$testroot/repo-clone"
1943 1a0d06a3 2023-02-20 stsp branch { "master" }
1946 1a0d06a3 2023-02-20 stsp got fetch -q -r $testroot/repo-clone2 other \
1947 1a0d06a3 2023-02-20 stsp > $testroot/stdout 2> $testroot/stderr
1949 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1950 1a0d06a3 2023-02-20 stsp echo "got fetch command failed unexpectedly" >&2
1951 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1955 1a0d06a3 2023-02-20 stsp got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1957 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1958 1a0d06a3 2023-02-20 stsp echo "got ref command failed unexpectedly" >&2
1959 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1963 1a0d06a3 2023-02-20 stsp cat > $testroot/stdout.expected <<EOF
1964 1a0d06a3 2023-02-20 stsp HEAD: refs/heads/master
1965 1a0d06a3 2023-02-20 stsp refs/heads/master: $commit_id2
1966 1a0d06a3 2023-02-20 stsp refs/remotes/origin/HEAD: refs/remotes/origin/master
1967 1a0d06a3 2023-02-20 stsp refs/remotes/origin/master: $commit_id2
1968 1a0d06a3 2023-02-20 stsp refs/remotes/other/HEAD: refs/remotes/other/master
1969 1a0d06a3 2023-02-20 stsp refs/remotes/other/master: $commit_id
1971 1a0d06a3 2023-02-20 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1973 1a0d06a3 2023-02-20 stsp if [ $ret -ne 0 ]; then
1974 1a0d06a3 2023-02-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
1976 1a0d06a3 2023-02-20 stsp test_done "$testroot" "$ret"
1980 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1981 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1982 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1983 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1984 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1985 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1986 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1987 1b796c3f 2021-09-11 stsp run_test test_fetch_delete_branch_mirror
1988 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1989 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1990 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1991 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1992 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1993 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1994 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs
1995 1cb79834 2023-02-13 mark run_test test_fetch_honor_wt_conf_bflag
1996 1a0d06a3 2023-02-20 stsp run_test test_fetch_from_out_of_date_remote