Blame


1 c8c71e6e 2020-03-21 stsp #!/bin/sh
2 c8c71e6e 2020-03-21 stsp #
3 c8c71e6e 2020-03-21 stsp # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
4 c8c71e6e 2020-03-21 stsp #
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.
8 c8c71e6e 2020-03-21 stsp #
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.
16 c8c71e6e 2020-03-21 stsp
17 c8c71e6e 2020-03-21 stsp . ./common.sh
18 c8c71e6e 2020-03-21 stsp
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`
23 c8c71e6e 2020-03-21 stsp
24 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
25 c8c71e6e 2020-03-21 stsp ret="$?"
26 c8c71e6e 2020-03-21 stsp if [ "$ret" != "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"
29 c8c71e6e 2020-03-21 stsp return 1
30 c8c71e6e 2020-03-21 stsp fi
31 c8c71e6e 2020-03-21 stsp
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`
35 c8c71e6e 2020-03-21 stsp
36 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
37 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
38 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
39 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
40 c8c71e6e 2020-03-21 stsp return 1
41 c8c71e6e 2020-03-21 stsp fi
42 c8c71e6e 2020-03-21 stsp
43 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
44 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
45 c8c71e6e 2020-03-21 stsp ret="$?"
46 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
47 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
48 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
49 c8c71e6e 2020-03-21 stsp return 1
50 c8c71e6e 2020-03-21 stsp fi
51 c8c71e6e 2020-03-21 stsp
52 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
53 c8c71e6e 2020-03-21 stsp
54 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
55 c8c71e6e 2020-03-21 stsp ret="$?"
56 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
57 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
58 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
59 c8c71e6e 2020-03-21 stsp return 1
60 c8c71e6e 2020-03-21 stsp fi
61 c8c71e6e 2020-03-21 stsp
62 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
63 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
64 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
65 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
66 c8c71e6e 2020-03-21 stsp return 1
67 c8c71e6e 2020-03-21 stsp fi
68 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
69 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
70 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
71 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
72 c8c71e6e 2020-03-21 stsp return 1
73 c8c71e6e 2020-03-21 stsp fi
74 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
75 c8c71e6e 2020-03-21 stsp ret="$?"
76 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
77 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
78 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
79 c8c71e6e 2020-03-21 stsp return 1
80 c8c71e6e 2020-03-21 stsp fi
81 c8c71e6e 2020-03-21 stsp
82 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
83 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
84 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
85 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
86 c8c71e6e 2020-03-21 stsp return 1
87 c8c71e6e 2020-03-21 stsp fi
88 c8c71e6e 2020-03-21 stsp
89 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
90 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
91 c8c71e6e 2020-03-21 stsp
92 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
93 c8c71e6e 2020-03-21 stsp ret="$?"
94 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
95 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
96 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
97 c8c71e6e 2020-03-21 stsp return 1
98 c8c71e6e 2020-03-21 stsp fi
99 c8c71e6e 2020-03-21 stsp
100 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
101 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
102 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
103 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
104 c8c71e6e 2020-03-21 stsp return 1
105 c8c71e6e 2020-03-21 stsp fi
106 c8c71e6e 2020-03-21 stsp
107 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
108 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
109 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
110 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
111 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
112 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
113 c8c71e6e 2020-03-21 stsp
114 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
115 c8c71e6e 2020-03-21 stsp ret="$?"
116 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
117 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
118 c8c71e6e 2020-03-21 stsp fi
119 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
120 c8c71e6e 2020-03-21 stsp }
121 c8c71e6e 2020-03-21 stsp
122 f6cae3ed 2020-09-13 naddy test_fetch_list() {
123 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
124 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
125 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
126 c8c71e6e 2020-03-21 stsp
127 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
128 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
129 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
130 c8c71e6e 2020-03-21 stsp
131 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
132 c8c71e6e 2020-03-21 stsp ret="$?"
133 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
134 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
135 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
136 c8c71e6e 2020-03-21 stsp return 1
137 c8c71e6e 2020-03-21 stsp fi
138 c8c71e6e 2020-03-21 stsp
139 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l \
140 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
141 c8c71e6e 2020-03-21 stsp ret="$?"
142 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
143 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
144 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
145 c8c71e6e 2020-03-21 stsp return 1
146 c8c71e6e 2020-03-21 stsp fi
147 c8c71e6e 2020-03-21 stsp
148 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
149 c8c71e6e 2020-03-21 stsp
150 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
151 c8c71e6e 2020-03-21 stsp ret="$?"
152 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
153 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
154 c8c71e6e 2020-03-21 stsp fi
155 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
156 c8c71e6e 2020-03-21 stsp }
157 c8c71e6e 2020-03-21 stsp
158 f6cae3ed 2020-09-13 naddy test_fetch_branch() {
159 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
160 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
161 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
162 c8c71e6e 2020-03-21 stsp
163 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
164 c8c71e6e 2020-03-21 stsp ret="$?"
165 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
166 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
167 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
168 c8c71e6e 2020-03-21 stsp return 1
169 c8c71e6e 2020-03-21 stsp fi
170 c8c71e6e 2020-03-21 stsp
171 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
172 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
173 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
174 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
175 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
176 c8c71e6e 2020-03-21 stsp
177 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
178 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
179 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
180 c8c71e6e 2020-03-21 stsp
181 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
182 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
183 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
184 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
185 c8c71e6e 2020-03-21 stsp
186 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
187 c8c71e6e 2020-03-21 stsp ret="$?"
188 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
189 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
190 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
191 c8c71e6e 2020-03-21 stsp return 1
192 c8c71e6e 2020-03-21 stsp fi
193 c8c71e6e 2020-03-21 stsp
194 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
195 c8c71e6e 2020-03-21 stsp
196 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
197 c8c71e6e 2020-03-21 stsp ret="$?"
198 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
199 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
200 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
201 c8c71e6e 2020-03-21 stsp return 1
202 c8c71e6e 2020-03-21 stsp fi
203 c8c71e6e 2020-03-21 stsp
204 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
205 c8c71e6e 2020-03-21 stsp
206 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
207 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
208 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
209 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
210 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
211 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
212 c8c71e6e 2020-03-21 stsp # refs/remotes/origin/master is umodified because it wasn't fetched
213 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
214 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
215 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
216 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
217 c8c71e6e 2020-03-21 stsp
218 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
219 c8c71e6e 2020-03-21 stsp ret="$?"
220 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
221 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
222 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
223 c8c71e6e 2020-03-21 stsp return 1
224 c8c71e6e 2020-03-21 stsp fi
225 c8c71e6e 2020-03-21 stsp
226 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
227 c8c71e6e 2020-03-21 stsp ret="$?"
228 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
229 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
230 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
231 c8c71e6e 2020-03-21 stsp return 1
232 c8c71e6e 2020-03-21 stsp fi
233 c8c71e6e 2020-03-21 stsp
234 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
235 c8c71e6e 2020-03-21 stsp
236 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
237 c8c71e6e 2020-03-21 stsp ret="$?"
238 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
239 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
240 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
241 c8c71e6e 2020-03-21 stsp return 1
242 c8c71e6e 2020-03-21 stsp fi
243 c8c71e6e 2020-03-21 stsp
244 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
245 c8c71e6e 2020-03-21 stsp
246 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
247 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
248 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
249 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
250 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
251 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
252 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
253 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
254 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
255 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
256 c8c71e6e 2020-03-21 stsp
257 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
258 c8c71e6e 2020-03-21 stsp ret="$?"
259 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
260 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
261 c8c71e6e 2020-03-21 stsp fi
262 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
263 c8c71e6e 2020-03-21 stsp }
264 c8c71e6e 2020-03-21 stsp
265 f6cae3ed 2020-09-13 naddy test_fetch_all() {
266 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
267 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
268 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
269 c8c71e6e 2020-03-21 stsp
270 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
271 c8c71e6e 2020-03-21 stsp ret="$?"
272 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
273 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
274 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
275 c8c71e6e 2020-03-21 stsp return 1
276 c8c71e6e 2020-03-21 stsp fi
277 c8c71e6e 2020-03-21 stsp
278 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
279 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
280 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
281 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
282 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
283 c8c71e6e 2020-03-21 stsp
284 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
285 c8c71e6e 2020-03-21 stsp
286 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
287 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
288 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
289 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
290 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
291 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
292 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
293 c8c71e6e 2020-03-21 stsp
294 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
295 c8c71e6e 2020-03-21 stsp ret="$?"
296 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
297 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
298 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
299 c8c71e6e 2020-03-21 stsp return 1
300 c8c71e6e 2020-03-21 stsp fi
301 c8c71e6e 2020-03-21 stsp
302 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
303 c8c71e6e 2020-03-21 stsp ret="$?"
304 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
305 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
306 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
307 c8c71e6e 2020-03-21 stsp return 1
308 c8c71e6e 2020-03-21 stsp fi
309 c8c71e6e 2020-03-21 stsp
310 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
311 c8c71e6e 2020-03-21 stsp
312 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
313 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
314 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
315 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
316 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
317 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
318 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
319 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
320 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
321 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
322 c8c71e6e 2020-03-21 stsp
323 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
324 c8c71e6e 2020-03-21 stsp ret="$?"
325 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
326 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
327 c8c71e6e 2020-03-21 stsp fi
328 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
329 c8c71e6e 2020-03-21 stsp }
330 c8c71e6e 2020-03-21 stsp
331 f6cae3ed 2020-09-13 naddy test_fetch_empty_packfile() {
332 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
333 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
334 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
335 c8c71e6e 2020-03-21 stsp
336 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
337 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
338 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
339 c8c71e6e 2020-03-21 stsp
340 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
341 c8c71e6e 2020-03-21 stsp ret="$?"
342 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
343 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
344 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
345 c8c71e6e 2020-03-21 stsp return 1
346 c8c71e6e 2020-03-21 stsp fi
347 c8c71e6e 2020-03-21 stsp
348 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
349 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
350 c8c71e6e 2020-03-21 stsp
351 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
352 c8c71e6e 2020-03-21 stsp
353 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
354 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
355 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
356 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
357 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
358 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
359 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
360 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
361 c8c71e6e 2020-03-21 stsp
362 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
363 c8c71e6e 2020-03-21 stsp ret="$?"
364 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
365 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
366 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
367 c8c71e6e 2020-03-21 stsp return 1
368 c8c71e6e 2020-03-21 stsp fi
369 c8c71e6e 2020-03-21 stsp
370 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
371 c8c71e6e 2020-03-21 stsp ret="$?"
372 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
373 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
374 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
375 c8c71e6e 2020-03-21 stsp return 1
376 c8c71e6e 2020-03-21 stsp fi
377 c8c71e6e 2020-03-21 stsp
378 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
379 c8c71e6e 2020-03-21 stsp
380 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
381 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
382 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
383 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
384 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
385 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
386 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
387 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
388 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
389 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
390 c8c71e6e 2020-03-21 stsp
391 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
392 c8c71e6e 2020-03-21 stsp ret="$?"
393 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
394 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
395 c8c71e6e 2020-03-21 stsp fi
396 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
397 c8c71e6e 2020-03-21 stsp }
398 c8c71e6e 2020-03-21 stsp
399 f6cae3ed 2020-09-13 naddy test_fetch_delete_branch() {
400 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
401 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
402 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
403 c8c71e6e 2020-03-21 stsp
404 c8c71e6e 2020-03-21 stsp
405 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
406 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
407 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
408 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
409 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
410 c8c71e6e 2020-03-21 stsp
411 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
412 c8c71e6e 2020-03-21 stsp ret="$?"
413 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
414 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
415 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
416 c8c71e6e 2020-03-21 stsp return 1
417 c8c71e6e 2020-03-21 stsp fi
418 c8c71e6e 2020-03-21 stsp
419 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
420 c8c71e6e 2020-03-21 stsp
421 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
422 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
423 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
424 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
425 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
426 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
427 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
428 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
429 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
430 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
431 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
432 c8c71e6e 2020-03-21 stsp
433 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
434 c8c71e6e 2020-03-21 stsp ret="$?"
435 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
436 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
437 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
438 c8c71e6e 2020-03-21 stsp return 1
439 c8c71e6e 2020-03-21 stsp fi
440 c8c71e6e 2020-03-21 stsp
441 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -d foo
442 c8c71e6e 2020-03-21 stsp
443 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
444 c8c71e6e 2020-03-21 stsp ret="$?"
445 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
446 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
447 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
448 c8c71e6e 2020-03-21 stsp return 1
449 c8c71e6e 2020-03-21 stsp fi
450 c8c71e6e 2020-03-21 stsp
451 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
452 c8c71e6e 2020-03-21 stsp
453 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
454 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
455 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
456 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
457 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
458 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
459 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
460 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
461 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
462 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
463 c8c71e6e 2020-03-21 stsp
464 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
465 c8c71e6e 2020-03-21 stsp ret="$?"
466 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
467 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
468 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
469 c8c71e6e 2020-03-21 stsp return 1
470 c8c71e6e 2020-03-21 stsp fi
471 c8c71e6e 2020-03-21 stsp
472 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
473 c8c71e6e 2020-03-21 stsp ret="$?"
474 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
475 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
476 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
477 c8c71e6e 2020-03-21 stsp return 1
478 c8c71e6e 2020-03-21 stsp fi
479 c8c71e6e 2020-03-21 stsp
480 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
481 c8c71e6e 2020-03-21 stsp
482 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
483 c8c71e6e 2020-03-21 stsp ret="$?"
484 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
485 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
486 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
487 c8c71e6e 2020-03-21 stsp return 1
488 c8c71e6e 2020-03-21 stsp fi
489 c8c71e6e 2020-03-21 stsp
490 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
491 c8c71e6e 2020-03-21 stsp
492 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
493 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
494 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
495 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
496 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
497 3789fd73 2020-03-26 stsp # refs/remotes/origin/foo is now deleted
498 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
499 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
500 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
501 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
502 c8c71e6e 2020-03-21 stsp
503 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
504 c8c71e6e 2020-03-21 stsp ret="$?"
505 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
506 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
507 c8c71e6e 2020-03-21 stsp fi
508 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
509 c8c71e6e 2020-03-21 stsp
510 c8c71e6e 2020-03-21 stsp }
511 db6d8ad8 2020-03-21 stsp
512 f6cae3ed 2020-09-13 naddy test_fetch_update_tag() {
513 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
514 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
515 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
516 db6d8ad8 2020-03-21 stsp
517 db6d8ad8 2020-03-21 stsp
518 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
519 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
520 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
521 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
522 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
523 db6d8ad8 2020-03-21 stsp
524 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
525 db6d8ad8 2020-03-21 stsp ret="$?"
526 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
527 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
528 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
529 db6d8ad8 2020-03-21 stsp return 1
530 db6d8ad8 2020-03-21 stsp fi
531 db6d8ad8 2020-03-21 stsp
532 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
533 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
534 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
535 db6d8ad8 2020-03-21 stsp
536 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
537 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
538 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
539 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
540 db6d8ad8 2020-03-21 stsp
541 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
542 db6d8ad8 2020-03-21 stsp
543 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
544 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
545 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
546 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
547 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
548 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
549 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
550 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
551 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
552 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
553 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
554 c8c71e6e 2020-03-21 stsp
555 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
556 db6d8ad8 2020-03-21 stsp ret="$?"
557 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
558 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
559 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
560 db6d8ad8 2020-03-21 stsp return 1
561 db6d8ad8 2020-03-21 stsp fi
562 db6d8ad8 2020-03-21 stsp
563 98f64f14 2021-01-05 stsp got fetch -a -q -r $testroot/repo-clone
564 db6d8ad8 2020-03-21 stsp ret="$?"
565 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
566 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
567 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
568 db6d8ad8 2020-03-21 stsp return 1
569 db6d8ad8 2020-03-21 stsp fi
570 db6d8ad8 2020-03-21 stsp
571 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
572 db6d8ad8 2020-03-21 stsp
573 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
574 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
575 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
576 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
577 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
578 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
579 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
580 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
581 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
582 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
583 db6d8ad8 2020-03-21 stsp
584 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
585 db6d8ad8 2020-03-21 stsp ret="$?"
586 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
587 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
588 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
589 db6d8ad8 2020-03-21 stsp return 1
590 db6d8ad8 2020-03-21 stsp fi
591 db6d8ad8 2020-03-21 stsp
592 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
593 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
594 db6d8ad8 2020-03-21 stsp ret="$?"
595 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
596 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
597 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
598 db6d8ad8 2020-03-21 stsp return 1
599 db6d8ad8 2020-03-21 stsp fi
600 db6d8ad8 2020-03-21 stsp
601 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
602 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
603 db6d8ad8 2020-03-21 stsp
604 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
605 db6d8ad8 2020-03-21 stsp ret="$?"
606 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
607 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
608 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
609 db6d8ad8 2020-03-21 stsp return 1
610 db6d8ad8 2020-03-21 stsp fi
611 db6d8ad8 2020-03-21 stsp
612 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
613 db6d8ad8 2020-03-21 stsp
614 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
615 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
616 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
617 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
618 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
619 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
620 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
621 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
622 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
623 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
624 db6d8ad8 2020-03-21 stsp
625 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
626 db6d8ad8 2020-03-21 stsp ret="$?"
627 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
628 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
629 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
630 db6d8ad8 2020-03-21 stsp return 1
631 db6d8ad8 2020-03-21 stsp fi
632 db6d8ad8 2020-03-21 stsp
633 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
634 db6d8ad8 2020-03-21 stsp ret="$?"
635 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
636 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
637 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
638 db6d8ad8 2020-03-21 stsp return 1
639 db6d8ad8 2020-03-21 stsp fi
640 db6d8ad8 2020-03-21 stsp
641 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
642 db6d8ad8 2020-03-21 stsp
643 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
644 db6d8ad8 2020-03-21 stsp ret="$?"
645 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
646 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
647 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
648 db6d8ad8 2020-03-21 stsp return 1
649 db6d8ad8 2020-03-21 stsp fi
650 db6d8ad8 2020-03-21 stsp
651 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
652 db6d8ad8 2020-03-21 stsp
653 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
654 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
655 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
656 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
657 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
658 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
659 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
660 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
661 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
662 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
663 db6d8ad8 2020-03-21 stsp
664 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
665 db6d8ad8 2020-03-21 stsp ret="$?"
666 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
667 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
668 db6d8ad8 2020-03-21 stsp fi
669 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
670 db6d8ad8 2020-03-21 stsp }
671 0e4002ca 2020-03-21 stsp
672 f6cae3ed 2020-09-13 naddy test_fetch_reference() {
673 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
674 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
675 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
676 db6d8ad8 2020-03-21 stsp
677 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
678 0e4002ca 2020-03-21 stsp ret="$?"
679 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
680 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
681 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
682 0e4002ca 2020-03-21 stsp return 1
683 0e4002ca 2020-03-21 stsp fi
684 0e4002ca 2020-03-21 stsp
685 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
686 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
687 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
688 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
689 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
690 0e4002ca 2020-03-21 stsp
691 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
692 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
693 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
694 0e4002ca 2020-03-21 stsp
695 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
696 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
697 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
698 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
699 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
700 0e4002ca 2020-03-21 stsp
701 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
702 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
703 0e4002ca 2020-03-21 stsp ret="$?"
704 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
705 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
706 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
707 0e4002ca 2020-03-21 stsp return 1
708 0e4002ca 2020-03-21 stsp fi
709 0e4002ca 2020-03-21 stsp
710 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
711 0e4002ca 2020-03-21 stsp
712 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
713 0e4002ca 2020-03-21 stsp ret="$?"
714 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
715 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
716 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
717 0e4002ca 2020-03-21 stsp return 1
718 0e4002ca 2020-03-21 stsp fi
719 0e4002ca 2020-03-21 stsp
720 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
721 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
722 0e4002ca 2020-03-21 stsp
723 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
724 0e4002ca 2020-03-21 stsp ret="$?"
725 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
726 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
727 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
728 0e4002ca 2020-03-21 stsp return 1
729 0e4002ca 2020-03-21 stsp fi
730 0e4002ca 2020-03-21 stsp
731 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
732 0e4002ca 2020-03-21 stsp ret="$?"
733 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
734 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
735 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
736 0e4002ca 2020-03-21 stsp return 1
737 0e4002ca 2020-03-21 stsp fi
738 0e4002ca 2020-03-21 stsp
739 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
740 0e4002ca 2020-03-21 stsp
741 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
742 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
743 f298ae0f 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
744 f298ae0f 2020-03-25 stsp >> $testroot/stdout.expected
745 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
746 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
747 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
748 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
749 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
750 e8a967e0 2020-03-21 stsp
751 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
752 e8a967e0 2020-03-21 stsp ret="$?"
753 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
754 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
755 e8a967e0 2020-03-21 stsp fi
756 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
757 e8a967e0 2020-03-21 stsp
758 e8a967e0 2020-03-21 stsp }
759 e8a967e0 2020-03-21 stsp
760 f6cae3ed 2020-09-13 naddy test_fetch_replace_symref() {
761 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
762 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
763 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
764 e8a967e0 2020-03-21 stsp
765 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
766 e8a967e0 2020-03-21 stsp ret="$?"
767 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
768 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
769 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
770 e8a967e0 2020-03-21 stsp return 1
771 e8a967e0 2020-03-21 stsp fi
772 e8a967e0 2020-03-21 stsp
773 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
774 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
775 e8a967e0 2020-03-21 stsp
776 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
777 e8a967e0 2020-03-21 stsp
778 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
779 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
780 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
781 e8a967e0 2020-03-21 stsp
782 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
783 e8a967e0 2020-03-21 stsp ret="$?"
784 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
785 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
786 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
787 e8a967e0 2020-03-21 stsp return 1
788 e8a967e0 2020-03-21 stsp fi
789 0e4002ca 2020-03-21 stsp
790 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
791 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
792 e8a967e0 2020-03-21 stsp ret="$?"
793 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
794 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
795 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
796 e8a967e0 2020-03-21 stsp return 1
797 e8a967e0 2020-03-21 stsp fi
798 e8a967e0 2020-03-21 stsp
799 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
800 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
801 e8a967e0 2020-03-21 stsp
802 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
803 0e4002ca 2020-03-21 stsp ret="$?"
804 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
805 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
806 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
807 e8a967e0 2020-03-21 stsp return 1
808 0e4002ca 2020-03-21 stsp fi
809 e8a967e0 2020-03-21 stsp
810 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
811 e8a967e0 2020-03-21 stsp
812 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
813 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
814 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
815 f1bcca34 2020-03-25 stsp
816 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
817 f1bcca34 2020-03-25 stsp ret="$?"
818 f1bcca34 2020-03-25 stsp if [ "$ret" != "0" ]; then
819 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
820 f1bcca34 2020-03-25 stsp fi
821 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
822 f1bcca34 2020-03-25 stsp
823 f1bcca34 2020-03-25 stsp }
824 f1bcca34 2020-03-25 stsp
825 f6cae3ed 2020-09-13 naddy test_fetch_update_headref() {
826 f1bcca34 2020-03-25 stsp local testroot=`test_init fetch_update_headref`
827 f1bcca34 2020-03-25 stsp local testurl=ssh://127.0.0.1/$testroot
828 f1bcca34 2020-03-25 stsp local commit_id=`git_show_head $testroot/repo`
829 f1bcca34 2020-03-25 stsp
830 f1bcca34 2020-03-25 stsp got clone -q $testurl/repo $testroot/repo-clone
831 f1bcca34 2020-03-25 stsp ret="$?"
832 f1bcca34 2020-03-25 stsp if [ "$ret" != "0" ]; then
833 f1bcca34 2020-03-25 stsp echo "got clone command failed unexpectedly" >&2
834 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
835 f1bcca34 2020-03-25 stsp return 1
836 f1bcca34 2020-03-25 stsp fi
837 f1bcca34 2020-03-25 stsp
838 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
839 f1bcca34 2020-03-25 stsp
840 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
841 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
842 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
843 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
844 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
845 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
846 f1bcca34 2020-03-25 stsp
847 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
848 f1bcca34 2020-03-25 stsp ret="$?"
849 f1bcca34 2020-03-25 stsp if [ "$ret" != "0" ]; then
850 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
851 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
852 f1bcca34 2020-03-25 stsp return 1
853 f1bcca34 2020-03-25 stsp fi
854 e8a967e0 2020-03-21 stsp
855 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
856 f1bcca34 2020-03-25 stsp got ref -r $testroot/repo -s refs/heads/foo HEAD
857 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo > $testroot/stdout
858 f1bcca34 2020-03-25 stsp
859 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
860 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
861 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
862 f1bcca34 2020-03-25 stsp
863 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
864 e8a967e0 2020-03-21 stsp ret="$?"
865 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
866 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
867 f1bcca34 2020-03-25 stsp test_done "$testroot" "$ret"
868 f1bcca34 2020-03-25 stsp return 1
869 e8a967e0 2020-03-21 stsp fi
870 f1bcca34 2020-03-25 stsp
871 f1bcca34 2020-03-25 stsp got fetch -q -r $testroot/repo-clone
872 f1bcca34 2020-03-25 stsp
873 f1bcca34 2020-03-25 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
874 f1bcca34 2020-03-25 stsp
875 f1bcca34 2020-03-25 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
876 15d3c221 2021-01-05 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
877 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
878 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
879 15d3c221 2021-01-05 stsp echo "refs/remotes/origin/master: $commit_id" \
880 15d3c221 2021-01-05 stsp >> $testroot/stdout.expected
881 15d3c221 2021-01-05 stsp
882 15d3c221 2021-01-05 stsp cmp -s $testroot/stdout $testroot/stdout.expected
883 15d3c221 2021-01-05 stsp ret="$?"
884 15d3c221 2021-01-05 stsp if [ "$ret" != "0" ]; then
885 15d3c221 2021-01-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
886 15d3c221 2021-01-05 stsp test_done "$testroot" "$ret"
887 15d3c221 2021-01-05 stsp return 1
888 15d3c221 2021-01-05 stsp fi
889 15d3c221 2021-01-05 stsp
890 15d3c221 2021-01-05 stsp got fetch -q -r $testroot/repo-clone -a
891 15d3c221 2021-01-05 stsp
892 15d3c221 2021-01-05 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
893 15d3c221 2021-01-05 stsp
894 15d3c221 2021-01-05 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
895 f1bcca34 2020-03-25 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
896 f1bcca34 2020-03-25 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
897 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
898 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
899 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/foo: $commit_id" \
900 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
901 f1bcca34 2020-03-25 stsp echo "refs/remotes/origin/master: $commit_id" \
902 f1bcca34 2020-03-25 stsp >> $testroot/stdout.expected
903 f1bcca34 2020-03-25 stsp
904 f1bcca34 2020-03-25 stsp cmp -s $testroot/stdout $testroot/stdout.expected
905 f1bcca34 2020-03-25 stsp ret="$?"
906 f1bcca34 2020-03-25 stsp if [ "$ret" != "0" ]; then
907 f1bcca34 2020-03-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
908 f1bcca34 2020-03-25 stsp fi
909 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
910 bcf34b0e 2020-03-26 stsp }
911 bcf34b0e 2020-03-26 stsp
912 f6cae3ed 2020-09-13 naddy test_fetch_headref_deleted_locally() {
913 bcf34b0e 2020-03-26 stsp local testroot=`test_init fetch_headref_deleted_locally`
914 bcf34b0e 2020-03-26 stsp local testurl=ssh://127.0.0.1/$testroot
915 bcf34b0e 2020-03-26 stsp local commit_id=`git_show_head $testroot/repo`
916 bcf34b0e 2020-03-26 stsp
917 bcf34b0e 2020-03-26 stsp got clone -q $testurl/repo $testroot/repo-clone
918 bcf34b0e 2020-03-26 stsp ret="$?"
919 bcf34b0e 2020-03-26 stsp if [ "$ret" != "0" ]; then
920 bcf34b0e 2020-03-26 stsp echo "got clone command failed unexpectedly" >&2
921 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
922 bcf34b0e 2020-03-26 stsp return 1
923 bcf34b0e 2020-03-26 stsp fi
924 bcf34b0e 2020-03-26 stsp
925 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
926 0e4002ca 2020-03-21 stsp
927 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
928 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
929 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
930 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
931 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
932 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
933 bcf34b0e 2020-03-26 stsp
934 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
935 bcf34b0e 2020-03-26 stsp ret="$?"
936 bcf34b0e 2020-03-26 stsp if [ "$ret" != "0" ]; then
937 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
938 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
939 bcf34b0e 2020-03-26 stsp return 1
940 bcf34b0e 2020-03-26 stsp fi
941 bcf34b0e 2020-03-26 stsp
942 993f033b 2021-07-16 stsp got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
943 bcf34b0e 2020-03-26 stsp
944 bcf34b0e 2020-03-26 stsp got fetch -q -r $testroot/repo-clone
945 bcf34b0e 2020-03-26 stsp ret="$?"
946 bcf34b0e 2020-03-26 stsp if [ "$ret" != "0" ]; then
947 bcf34b0e 2020-03-26 stsp echo "got fetch command failed unexpectedly" >&2
948 bcf34b0e 2020-03-26 stsp test_done "$testroot" "$ret"
949 bcf34b0e 2020-03-26 stsp return 1
950 bcf34b0e 2020-03-26 stsp fi
951 bcf34b0e 2020-03-26 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
952 bcf34b0e 2020-03-26 stsp
953 bcf34b0e 2020-03-26 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
954 bcf34b0e 2020-03-26 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
955 bcf34b0e 2020-03-26 stsp # refs/remotes/origin/HEAD has been restored:
956 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
957 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
958 bcf34b0e 2020-03-26 stsp echo "refs/remotes/origin/master: $commit_id" \
959 bcf34b0e 2020-03-26 stsp >> $testroot/stdout.expected
960 50b0790e 2020-09-11 stsp
961 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
962 50b0790e 2020-09-11 stsp ret="$?"
963 50b0790e 2020-09-11 stsp if [ "$ret" != "0" ]; then
964 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
965 50b0790e 2020-09-11 stsp fi
966 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
967 50b0790e 2020-09-11 stsp }
968 50b0790e 2020-09-11 stsp
969 f6cae3ed 2020-09-13 naddy test_fetch_gotconfig_remote_repo() {
970 50b0790e 2020-09-11 stsp local testroot=`test_init fetch_gotconfig_remote_repo`
971 50b0790e 2020-09-11 stsp local testurl=ssh://127.0.0.1/$testroot
972 50b0790e 2020-09-11 stsp local commit_id=`git_show_head $testroot/repo`
973 50b0790e 2020-09-11 stsp
974 50b0790e 2020-09-11 stsp got branch -r $testroot/repo -c $commit_id foo
975 50b0790e 2020-09-11 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
976 50b0790e 2020-09-11 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
977 50b0790e 2020-09-11 stsp
978 50b0790e 2020-09-11 stsp got clone -q $testurl/repo $testroot/repo-clone
979 50b0790e 2020-09-11 stsp ret="$?"
980 50b0790e 2020-09-11 stsp if [ "$ret" != "0" ]; then
981 50b0790e 2020-09-11 stsp echo "got clone command failed unexpectedly" >&2
982 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
983 50b0790e 2020-09-11 stsp return 1
984 50b0790e 2020-09-11 stsp fi
985 50b0790e 2020-09-11 stsp
986 50b0790e 2020-09-11 stsp cat > $testroot/repo-clone/got.conf <<EOF
987 50b0790e 2020-09-11 stsp remote "foobar" {
988 50b0790e 2020-09-11 stsp protocol ssh
989 50b0790e 2020-09-11 stsp server 127.0.0.1
990 50b0790e 2020-09-11 stsp repository "$testroot/repo"
991 50b0790e 2020-09-11 stsp }
992 50b0790e 2020-09-11 stsp
993 50b0790e 2020-09-11 stsp remote "barbaz" {
994 50b0790e 2020-09-11 stsp protocol ssh
995 50b0790e 2020-09-11 stsp server 127.0.0.1
996 50b0790e 2020-09-11 stsp repository "$testroot/does-not-exist"
997 50b0790e 2020-09-11 stsp }
998 50b0790e 2020-09-11 stsp EOF
999 54eb00d5 2020-10-20 stsp echo "got: nonexistent: remote repository not found" \
1000 54eb00d5 2020-10-20 stsp > $testroot/stderr.expected
1001 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q nonexistent \
1002 54eb00d5 2020-10-20 stsp > $testroot/stdout 2> $testroot/stderr)
1003 54eb00d5 2020-10-20 stsp ret="$?"
1004 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
1005 54eb00d5 2020-10-20 stsp echo "got fetch command succeeded unexpectedly" >&2
1006 54eb00d5 2020-10-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
1007 54eb00d5 2020-10-20 stsp test_done "$testroot" "1"
1008 54eb00d5 2020-10-20 stsp return 1
1009 54eb00d5 2020-10-20 stsp fi
1010 54eb00d5 2020-10-20 stsp
1011 612392ee 2021-01-05 stsp (cd $testroot/repo-clone && got fetch -q -l foobar \
1012 50b0790e 2020-09-11 stsp > $testroot/stdout)
1013 50b0790e 2020-09-11 stsp ret="$?"
1014 50b0790e 2020-09-11 stsp if [ "$ret" != "0" ]; then
1015 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1016 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1017 50b0790e 2020-09-11 stsp return 1
1018 50b0790e 2020-09-11 stsp fi
1019 bcf34b0e 2020-03-26 stsp
1020 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1021 50b0790e 2020-09-11 stsp
1022 bcf34b0e 2020-03-26 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1023 bcf34b0e 2020-03-26 stsp ret="$?"
1024 bcf34b0e 2020-03-26 stsp if [ "$ret" != "0" ]; then
1025 bcf34b0e 2020-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
1026 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1027 50b0790e 2020-09-11 stsp return 1
1028 bcf34b0e 2020-03-26 stsp fi
1029 50b0790e 2020-09-11 stsp
1030 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1031 50b0790e 2020-09-11 stsp
1032 50b0790e 2020-09-11 stsp cat > $testroot/wt/.got/got.conf <<EOF
1033 50b0790e 2020-09-11 stsp remote "barbaz" {
1034 50b0790e 2020-09-11 stsp protocol ssh
1035 50b0790e 2020-09-11 stsp server 127.0.0.1
1036 50b0790e 2020-09-11 stsp repository "$testroot/repo"
1037 50b0790e 2020-09-11 stsp }
1038 50b0790e 2020-09-11 stsp EOF
1039 612392ee 2021-01-05 stsp (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1040 50b0790e 2020-09-11 stsp ret="$?"
1041 50b0790e 2020-09-11 stsp if [ "$ret" != "0" ]; then
1042 50b0790e 2020-09-11 stsp echo "got fetch command failed unexpectedly" >&2
1043 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
1044 50b0790e 2020-09-11 stsp return 1
1045 50b0790e 2020-09-11 stsp fi
1046 50b0790e 2020-09-11 stsp
1047 612392ee 2021-01-05 stsp got ref -l -r $testroot/repo > $testroot/stdout.expected
1048 50b0790e 2020-09-11 stsp
1049 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1050 50b0790e 2020-09-11 stsp ret="$?"
1051 50b0790e 2020-09-11 stsp if [ "$ret" != "0" ]; then
1052 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
1053 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1054 99495ddb 2021-01-10 stsp return 1
1055 99495ddb 2021-01-10 stsp fi
1056 50b0790e 2020-09-11 stsp
1057 99495ddb 2021-01-10 stsp cat > $testroot/repo-clone/got.conf <<EOF
1058 99495ddb 2021-01-10 stsp remote "origin" {
1059 99495ddb 2021-01-10 stsp protocol ssh
1060 99495ddb 2021-01-10 stsp server 127.0.0.1
1061 99495ddb 2021-01-10 stsp repository "$testroot/repo"
1062 99495ddb 2021-01-10 stsp branch { "foo" }
1063 99495ddb 2021-01-10 stsp reference { "hoo/boo/zoo" }
1064 0e4002ca 2020-03-21 stsp }
1065 99495ddb 2021-01-10 stsp EOF
1066 99495ddb 2021-01-10 stsp (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1067 0e4002ca 2020-03-21 stsp
1068 99495ddb 2021-01-10 stsp local tag_id=`got ref -r $testroot/repo -l \
1069 99495ddb 2021-01-10 stsp | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1070 99495ddb 2021-01-10 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1071 99495ddb 2021-01-10 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1072 99495ddb 2021-01-10 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1073 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1074 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1075 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/foo: $commit_id" \
1076 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1077 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1078 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1079 99495ddb 2021-01-10 stsp echo "refs/remotes/origin/master: $commit_id" \
1080 99495ddb 2021-01-10 stsp >> $testroot/stdout.expected
1081 99495ddb 2021-01-10 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1082 99495ddb 2021-01-10 stsp
1083 99495ddb 2021-01-10 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1084 99495ddb 2021-01-10 stsp
1085 99495ddb 2021-01-10 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1086 99495ddb 2021-01-10 stsp ret="$?"
1087 99495ddb 2021-01-10 stsp if [ "$ret" != "0" ]; then
1088 99495ddb 2021-01-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1089 99495ddb 2021-01-10 stsp fi
1090 99495ddb 2021-01-10 stsp test_done "$testroot" "$ret"
1091 99495ddb 2021-01-10 stsp }
1092 99495ddb 2021-01-10 stsp
1093 161728eb 2021-07-24 stsp test_fetch_delete_remote_refs() {
1094 161728eb 2021-07-24 stsp local testroot=`test_init fetch_basic`
1095 161728eb 2021-07-24 stsp local testurl=ssh://127.0.0.1/$testroot
1096 161728eb 2021-07-24 stsp local commit_id=`git_show_head $testroot/repo`
1097 161728eb 2021-07-24 stsp
1098 161728eb 2021-07-24 stsp got clone -q $testurl/repo $testroot/repo-clone
1099 161728eb 2021-07-24 stsp ret="$?"
1100 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1101 161728eb 2021-07-24 stsp echo "got clone command failed unexpectedly" >&2
1102 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1103 161728eb 2021-07-24 stsp return 1
1104 161728eb 2021-07-24 stsp fi
1105 161728eb 2021-07-24 stsp
1106 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1107 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1108 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1109 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1110 161728eb 2021-07-24 stsp return 1
1111 161728eb 2021-07-24 stsp fi
1112 161728eb 2021-07-24 stsp
1113 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1114 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1115 161728eb 2021-07-24 stsp echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1116 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1117 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master: $commit_id" \
1118 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1119 161728eb 2021-07-24 stsp
1120 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1121 161728eb 2021-07-24 stsp ret="$?"
1122 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1123 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1124 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1125 161728eb 2021-07-24 stsp return 1
1126 161728eb 2021-07-24 stsp fi
1127 161728eb 2021-07-24 stsp
1128 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1129 161728eb 2021-07-24 stsp 2> $testroot/stderr
1130 161728eb 2021-07-24 stsp ret="$?"
1131 3379373c 2021-08-26 naddy if [ "$ret" = "0" ]; then
1132 161728eb 2021-07-24 stsp echo "got fetch command succeeded unexpectedly" >&2
1133 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1134 161728eb 2021-07-24 stsp return 1
1135 161728eb 2021-07-24 stsp fi
1136 161728eb 2021-07-24 stsp
1137 161728eb 2021-07-24 stsp echo "got: -X option requires a remote name" > $testroot/stderr.expected
1138 161728eb 2021-07-24 stsp cmp -s $testroot/stderr $testroot/stderr.expected
1139 161728eb 2021-07-24 stsp ret="$?"
1140 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1141 161728eb 2021-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
1142 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1143 161728eb 2021-07-24 stsp return 1
1144 161728eb 2021-07-24 stsp fi
1145 161728eb 2021-07-24 stsp
1146 161728eb 2021-07-24 stsp got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1147 161728eb 2021-07-24 stsp 2> $testroot/stderr
1148 161728eb 2021-07-24 stsp ret="$?"
1149 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1150 161728eb 2021-07-24 stsp echo "got fetch command failed unexpectedly" >&2
1151 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1152 161728eb 2021-07-24 stsp return 1
1153 161728eb 2021-07-24 stsp fi
1154 161728eb 2021-07-24 stsp
1155 161728eb 2021-07-24 stsp echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1156 161728eb 2021-07-24 stsp echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1157 161728eb 2021-07-24 stsp echo "Deleted refs/remotes/origin/master: $commit_id" \
1158 161728eb 2021-07-24 stsp >> $testroot/stdout.expected
1159 161728eb 2021-07-24 stsp
1160 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1161 161728eb 2021-07-24 stsp ret="$?"
1162 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1163 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1164 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1165 161728eb 2021-07-24 stsp return 1
1166 161728eb 2021-07-24 stsp fi
1167 161728eb 2021-07-24 stsp
1168 161728eb 2021-07-24 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
1169 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1170 161728eb 2021-07-24 stsp echo "got ref command failed unexpectedly" >&2
1171 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1172 161728eb 2021-07-24 stsp return 1
1173 161728eb 2021-07-24 stsp fi
1174 161728eb 2021-07-24 stsp
1175 161728eb 2021-07-24 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1176 161728eb 2021-07-24 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1177 161728eb 2021-07-24 stsp
1178 161728eb 2021-07-24 stsp cmp -s $testroot/stdout $testroot/stdout.expected
1179 161728eb 2021-07-24 stsp ret="$?"
1180 161728eb 2021-07-24 stsp if [ "$ret" != "0" ]; then
1181 161728eb 2021-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1182 161728eb 2021-07-24 stsp fi
1183 161728eb 2021-07-24 stsp test_done "$testroot" "$ret"
1184 161728eb 2021-07-24 stsp }
1185 161728eb 2021-07-24 stsp
1186 161728eb 2021-07-24 stsp
1187 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1188 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
1189 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
1190 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
1191 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
1192 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
1193 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
1194 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
1195 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
1196 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref
1197 f1bcca34 2020-03-25 stsp run_test test_fetch_update_headref
1198 bcf34b0e 2020-03-26 stsp run_test test_fetch_headref_deleted_locally
1199 50b0790e 2020-09-11 stsp run_test test_fetch_gotconfig_remote_repo
1200 161728eb 2021-07-24 stsp run_test test_fetch_delete_remote_refs