Debian Codegraph @

t/t-push-failures-local.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 . "$(dirnamescip-shell system . . dirname. "$0")/testlib.sh"
4
5 begin_test "push allow missing object (lfs.allowincompletepush true)"
6 (
7 set -e
8
9 reponame="push-allow-missing-object"
10 setup_remote_repo "$reponame"
11 clone_repo "$reponame" "$reponame"
12
13 gitscip-shell system . . git. lfs track "*.dat"
14 gitscip-shell system . . git. add .gitattributes
15 gitscip-shell system . . git. commit -m "initial commit"
16
17 present="present"
18 present_oid="$(calc_oid "$present")"
19 printfscip-shell system . . printf. "%s" "$present" > present.dat
20
21 missing="missing"
22 missing_oid="$(calc_oid "$missing")"
23 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
24
25 gitscip-shell system . . git. add present.dat missing.dat
26 gitscip-shell system . . git. commit -m "add objects"
27
28 delete_local_object "$missing_oid"
29
30 gitscip-shell system . . git. config lfs.allowincompletepush true
31
32 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
33 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
34 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to succeed ..."
35 exit 1
36 fi
37
38 grepscip-shell system . . grep. "LFS upload missing objects" push.log
39 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
40
41 assert_server_object "$reponame" "$present_oid"
42 refute_server_object "$reponame" "$missing_oid"
43 )
44 end_test
45
46 begin_test "push allow missing object (lfs.allowincompletepush true) (git-lfs-transfer)"
47 (
48 set -e
49
50 setup_pure_ssh
51
52 reponame="push-ssh-allow-missing-object"
53 setup_remote_repo "$reponame"
54 clone_repo "$reponame" "$reponame"
55
56 sshurl=$(ssh_remote "$reponame")
57 gitscip-shell system . . git. config lfs.url "$sshurl"
58
59 gitscip-shell system . . git. lfs track "*.dat"
60 gitscip-shell system . . git. add .gitattributes
61 gitscip-shell system . . git. commit -m "initial commit"
62
63 present="present"
64 present_oid="$(calc_oid "$present")"
65 printfscip-shell system . . printf. "%s" "$present" > present.dat
66
67 missing="missing"
68 missing_oid="$(calc_oid "$missing")"
69 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
70
71 gitscip-shell system . . git. add present.dat missing.dat
72 gitscip-shell system . . git. commit -m "add objects"
73
74 delete_local_object "$missing_oid"
75
76 gitscip-shell system . . git. config lfs.allowincompletepush true
77
78 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
79 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
80 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to succeed ..."
81 exit 1
82 fi
83
84 grepscip-shell system . . grep. "pure SSH connection successful" push.log
85
86 grepscip-shell system . . grep. "LFS upload missing objects" push.log
87 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
88
89 assert_remote_object "$reponame" "$present_oid" "${#present}"
90 refute_remote_object "$reponame" "$missing_oid"
91 )
92 end_test
93
94 begin_test "push reject missing object (lfs.allowincompletepush false)"
95 (
96 set -e
97
98 reponame="push-reject-missing-object"
99 setup_remote_repo "$reponame"
100 clone_repo "$reponame" "$reponame"
101
102 gitscip-shell system . . git. lfs track "*.dat"
103 gitscip-shell system . . git. add .gitattributes
104 gitscip-shell system . . git. commit -m "initial commit"
105
106 present="present"
107 present_oid="$(calc_oid "$present")"
108 printfscip-shell system . . printf. "%s" "$present" > present.dat
109
110 missing="missing"
111 missing_oid="$(calc_oid "$missing")"
112 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
113
114 gitscip-shell system . . git. add present.dat missing.dat
115 gitscip-shell system . . git. commit -m "add objects"
116
117 delete_local_object "$missing_oid"
118
119 gitscip-shell system . . git. config lfs.allowincompletepush false
120
121 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
122 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
123 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
124 exit 1
125 fi
126
127 grepscip-shell system . . grep. "tq: stopping batched queue, object \"$missing_oid\" missing locally and on remote" push.log
128 grepscip-shell system . . grep. "LFS upload failed:" push.log
129 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
130
131 refute_server_object "$reponame" "$present_oid"
132 refute_server_object "$reponame" "$missing_oid"
133 )
134 end_test
135
136 begin_test "push reject missing object (lfs.allowincompletepush false) (git-lfs-transfer)"
137 (
138 set -e
139
140 setup_pure_ssh
141
142 reponame="push-ssh-reject-missing-object"
143 setup_remote_repo "$reponame"
144 clone_repo "$reponame" "$reponame"
145
146 sshurl=$(ssh_remote "$reponame")
147 gitscip-shell system . . git. config lfs.url "$sshurl"
148
149 gitscip-shell system . . git. lfs track "*.dat"
150 gitscip-shell system . . git. add .gitattributes
151 gitscip-shell system . . git. commit -m "initial commit"
152
153 present="present"
154 present_oid="$(calc_oid "$present")"
155 printfscip-shell system . . printf. "%s" "$present" > present.dat
156
157 missing="missing"
158 missing_oid="$(calc_oid "$missing")"
159 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
160
161 gitscip-shell system . . git. add present.dat missing.dat
162 gitscip-shell system . . git. commit -m "add objects"
163
164 delete_local_object "$missing_oid"
165
166 gitscip-shell system . . git. config lfs.allowincompletepush false
167
168 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
169 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
170 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
171 exit 1
172 fi
173
174 grepscip-shell system . . grep. "pure SSH connection successful" push.log
175
176 grepscip-shell system . . grep. "tq: stopping batched queue, object \"$missing_oid\" missing locally and on remote" push.log
177 grepscip-shell system . . grep. "LFS upload failed:" push.log
178 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
179
180 refute_remote_object "$reponame" "$present_oid"
181 refute_remote_object "$reponame" "$missing_oid"
182 )
183 end_test
184
185 begin_test "push reject missing object (lfs.allowincompletepush default)"
186 (
187 set -e
188
189 reponame="push-reject-missing-object-default"
190 setup_remote_repo "$reponame"
191 clone_repo "$reponame" "$reponame"
192
193 gitscip-shell system . . git. lfs track "*.dat"
194 gitscip-shell system . . git. add .gitattributes
195 gitscip-shell system . . git. commit -m "initial commit"
196
197 present="present"
198 present_oid="$(calc_oid "$present")"
199 printfscip-shell system . . printf. "%s" "$present" > present.dat
200
201 missing="missing"
202 missing_oid="$(calc_oid "$missing")"
203 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
204
205 gitscip-shell system . . git. add present.dat missing.dat
206 gitscip-shell system . . git. commit -m "add objects"
207
208 delete_local_object "$missing_oid"
209
210 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
211 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
212 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
213 exit 1
214 fi
215
216 grepscip-shell system . . grep. "tq: stopping batched queue, object \"$missing_oid\" missing locally and on remote" push.log
217 grepscip-shell system . . grep. "LFS upload failed:" push.log
218 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
219
220 refute_server_object "$reponame" "$present_oid"
221 refute_server_object "$reponame" "$missing_oid"
222 )
223 end_test
224
225 begin_test "push reject missing object (lfs.allowincompletepush default) (git-lfs-transfer)"
226 (
227 set -e
228
229 setup_pure_ssh
230
231 reponame="push-ssh-reject-missing-object-default"
232 setup_remote_repo "$reponame"
233 clone_repo "$reponame" "$reponame"
234
235 sshurl=$(ssh_remote "$reponame")
236 gitscip-shell system . . git. config lfs.url "$sshurl"
237
238 gitscip-shell system . . git. lfs track "*.dat"
239 gitscip-shell system . . git. add .gitattributes
240 gitscip-shell system . . git. commit -m "initial commit"
241
242 present="present"
243 present_oid="$(calc_oid "$present")"
244 printfscip-shell system . . printf. "%s" "$present" > present.dat
245
246 missing="missing"
247 missing_oid="$(calc_oid "$missing")"
248 printfscip-shell system . . printf. "%s" "$missing" > missing.dat
249
250 gitscip-shell system . . git. add present.dat missing.dat
251 gitscip-shell system . . git. commit -m "add objects"
252
253 delete_local_object "$missing_oid"
254
255 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
256 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
257 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
258 exit 1
259 fi
260
261 grepscip-shell system . . grep. "pure SSH connection successful" push.log
262
263 grepscip-shell system . . grep. "tq: stopping batched queue, object \"$missing_oid\" missing locally and on remote" push.log
264 grepscip-shell system . . grep. "LFS upload failed:" push.log
265 grepscip-shell system . . grep. " (missing) missing.dat ($missing_oid)" push.log
266
267 refute_remote_object "$reponame" "$present_oid"
268 refute_remote_object "$reponame" "$missing_oid"
269 )
270 end_test
271
272 begin_test "push reject corrupt object (lfs.allowincompletepush default)"
273 (
274 set -e
275
276 reponame="push-reject-corrupt-object"
277 setup_remote_repo "$reponame"
278 clone_repo "$reponame" "$reponame"
279
280 gitscip-shell system . . git. lfs track "*.dat"
281 gitscip-shell system . . git. add .gitattributes
282 gitscip-shell system . . git. commit -m "initial commit"
283
284 present="present"
285 present_oid="$(calc_oid "$present")"
286 printfscip-shell system . . printf. "%s" "$present" > present.dat
287
288 corrupt="corrupt"
289 corrupt_oid="$(calc_oid "$corrupt")"
290 printfscip-shell system . . printf. "%s" "$corrupt" > corrupt.dat
291
292 gitscip-shell system . . git. add present.dat corrupt.dat
293 gitscip-shell system . . git. commit -m "add objects"
294
295 corrupt_local_object "$corrupt_oid"
296
297 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
298 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
299 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
300 exit 1
301 fi
302
303 grepscip-shell system . . grep. "LFS upload failed:" push.log
304 grepscip-shell system . . grep. " (corrupt) corrupt.dat ($corrupt_oid)" push.log
305
306 assert_server_object "$reponame" "$present_oid"
307 refute_server_object "$reponame" "$corrupt_oid"
308 )
309 end_test
310
311 begin_test "push reject corrupt object (lfs.allowincompletepush default) (git-lfs-transfer)"
312 (
313 set -e
314
315 setup_pure_ssh
316
317 reponame="push-ssh-reject-corrupt-object-default"
318 setup_remote_repo "$reponame"
319 clone_repo "$reponame" "$reponame"
320
321 sshurl=$(ssh_remote "$reponame")
322 gitscip-shell system . . git. config lfs.url "$sshurl"
323
324 gitscip-shell system . . git. lfs track "*.dat"
325 gitscip-shell system . . git. add .gitattributes
326 gitscip-shell system . . git. commit -m "initial commit"
327
328 present="present"
329 present_oid="$(calc_oid "$present")"
330 printfscip-shell system . . printf. "%s" "$present" > present.dat
331
332 corrupt="corrupt"
333 corrupt_oid="$(calc_oid "$corrupt")"
334 printfscip-shell system . . printf. "%s" "$corrupt" > corrupt.dat
335
336 gitscip-shell system . . git. add present.dat corrupt.dat
337 gitscip-shell system . . git. commit -m "add objects"
338
339 corrupt_local_object "$corrupt_oid"
340
341 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
342 if [scip-shell system . . `[`. "1" -ne "${PIPESTATUS[0]}" ]; then
343 echoscip-shell system . . echo. >&2 "fatal: expected 'git push origin main' to fail ..."
344 exit 1
345 fi
346
347 grepscip-shell system . . grep. "pure SSH connection successful" push.log
348
349 grepscip-shell system . . grep. "LFS upload failed:" push.log
350 grepscip-shell system . . grep. " (corrupt) corrupt.dat ($corrupt_oid)" push.log
351
352 assert_remote_object "$reponame" "$present_oid" "${#present}"
353 refute_remote_object "$reponame" "$corrupt_oid"
354 )
355 end_test