Debian Codegraph @

t/t-custom-transfers.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 "custom-transfer-wrong-path"
6 (
7 set -e
8
9 # this repo name is the indicator to the server to support custom transfer
10 reponame="custom-transfer-wrong-path"
11 setup_remote_repo "$reponame"
12
13 clone_repo "$reponame" $reponame
14
15 # deliberately incorrect path
16 gitscip-shell system . . git. config lfs.customtransfer.testcustom.path path-to-nothing
17
18 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
19 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
20
21 contents="jksgdfljkgsdlkjafg lsjdgf alkjgsd lkfjag sldjkgf alkjsgdflkjagsd kljfg asdjgf kalsd"
22 contents_oid=$(calc_oid "$contents")
23
24 printfscip-shell system . . printf. "%s" "$contents" > a.dat
25 gitscip-shell system . . git. add a.dat
26 gitscip-shell system . . git. add .gitattributes
27 gitscip-shell system . . git. commit -m "add a.dat" 2>&1 | teescip-shell system . . tee. commit.log
28 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. pushcustom.log
29 # use PIPESTATUS otherwise we get exit code from tee
30 res=${PIPESTATUS[0]}
31 grepscip-shell system . . grep. "xfer: adapter \"testcustom\" Begin()" pushcustom.log
32 grepscip-shell system . . grep. "xfer: Aborting worker process" pushcustom.log
33 if [scip-shell system . . `[`. "$res" = "0" ]; then
34 echoscip-shell system . . echo. "Push should have failed because of an incorrect custom transfer path."
35 exit 1
36 fi
37
38 )
39 end_test
40
41 begin_test "custom-transfer-upload-download"
42 (
43 set -e
44
45 # this repo name is the indicator to the server to support custom transfer
46 reponame="custom-transfer-upload-download"
47 setup_remote_repo "$reponame"
48
49 clone_repo "$reponame" $reponame
50
51 # set up custom transfer adapter
52 gitscip-shell system . . git. config lfs.customtransfer.testcustom.path lfstest-customadapter
53
54 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
55 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
56 gitscip-shell system . . git. add .gitattributes
57 gitscip-shell system . . git. commit -m "Tracking"
58
59 # set up a decent amount of data so that there's work for multiple concurrent adapters
60 echoscip-shell system . . echo. "[
61 {
62 \"CommitDate\":\"$(get_date -10d)\",
63 \"Files\":[
64 {\"Filename\":\"verify.dat\",\"Size\":18,\"Data\":\"send-verify-action\"},
65 {\"Filename\":\"file1.dat\",\"Size\":1024},
66 {\"Filename\":\"file2.dat\",\"Size\":750}]
67 },
68 {
69 \"CommitDate\":\"$(get_date -7d)\",
70 \"Files\":[
71 {\"Filename\":\"file1.dat\",\"Size\":1050},
72 {\"Filename\":\"file3.dat\",\"Size\":660},
73 {\"Filename\":\"file4.dat\",\"Size\":230}]
74 },
75 {
76 \"CommitDate\":\"$(get_date -5d)\",
77 \"Files\":[
78 {\"Filename\":\"file5.dat\",\"Size\":1200},
79 {\"Filename\":\"file6.dat\",\"Size\":300}]
80 },
81 {
82 \"CommitDate\":\"$(get_date -2d)\",
83 \"Files\":[
84 {\"Filename\":\"file3.dat\",\"Size\":120},
85 {\"Filename\":\"file5.dat\",\"Size\":450},
86 {\"Filename\":\"file7.dat\",\"Size\":520},
87 {\"Filename\":\"file8.dat\",\"Size\":2048}]
88 }
89 ]" | lfstest-testutils addcommits
90
91 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. pushcustom.log
92 # use PIPESTATUS otherwise we get exit code from tee
93 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
94
95 grepscip-shell system . . grep. "xfer: started custom adapter process" pushcustom.log
96 grepscip-shell system . . grep. "xfer\[lfstest-customadapter\]:" pushcustom.log
97 grepscip-shell system . . grep. "Uploading LFS objects: 100% (12/12)" pushcustom.log
98
99 rmscip-shell system . . rm. -rf .git/lfs/objects
100 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. lfs fetch --all 2>&1 | teescip-shell system . . tee. fetchcustom.log
101 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
102
103 grepscip-shell system . . grep. "xfer: started custom adapter process" fetchcustom.log
104 grepscip-shell system . . grep. "xfer\[lfstest-customadapter\]:" fetchcustom.log
105
106 grepscip-shell system . . grep. "Terminating test custom adapter gracefully" fetchcustom.log
107
108 objectlist=`findscip-shell system . . find. .git/lfs/objects -type f`
109 [scip-shell system . . `[`. "$(echoscip-shell system . . echo. "$objectlist" | wcscip-shell system . . wc. -l)" -eq 12 ]
110 )
111 end_test
112
113 begin_test "custom-transfer-standalone"
114 (
115 set -e
116
117 # setup a git repo to be used as a local repo, not remote
118 reponame="custom-transfer-standalone"
119 setup_remote_repo "$reponame"
120
121 # clone directly, not through lfstest-gitserver
122 clone_repo_url "$REMOTEDIR/$reponame.git" $reponame
123
124 # set up custom transfer adapter to use a specific transfer agent
125 gitscip-shell system . . git. config lfs.customtransfer.testcustom.path lfstest-standalonecustomadapter
126 gitscip-shell system . . git. config lfs.customtransfer.testcustom.args "--arg1 '--arg2 --arg3' --arg4"
127 gitscip-shell system . . git. config lfs.customtransfer.testcustom.concurrent false
128 gitscip-shell system . . git. config lfs.standalonetransferagent testcustom
129 export TEST_STANDALONE_BACKUP_PATH="$(pwdscip-shell system . . pwd.)/test-custom-transfer-standalone-backup"
130 mkdirscip-shell system . . mkdir. -p $TEST_STANDALONE_BACKUP_PATH
131 rmscip-shell system . . rm. -rf $TEST_STANDALONE_BACKUP_PATH/*
132
133 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
134 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
135 gitscip-shell system . . git. add .gitattributes
136 gitscip-shell system . . git. commit -m "Tracking"
137
138 # set up a decent amount of data so that there's work for multiple concurrent adapters
139 echoscip-shell system . . echo. "[
140 {
141 \"CommitDate\":\"$(get_date -10d)\",
142 \"Files\":[
143 {\"Filename\":\"verify.dat\",\"Size\":18,\"Data\":\"send-verify-action\"},
144 {\"Filename\":\"file1.dat\",\"Size\":1024},
145 {\"Filename\":\"file2.dat\",\"Size\":750}]
146 },
147 {
148 \"CommitDate\":\"$(get_date -7d)\",
149 \"Files\":[
150 {\"Filename\":\"file1.dat\",\"Size\":1050},
151 {\"Filename\":\"file3.dat\",\"Size\":660},
152 {\"Filename\":\"file4.dat\",\"Size\":230}]
153 },
154 {
155 \"CommitDate\":\"$(get_date -5d)\",
156 \"Files\":[
157 {\"Filename\":\"file5.dat\",\"Size\":1200},
158 {\"Filename\":\"file6.dat\",\"Size\":300}]
159 },
160 {
161 \"CommitDate\":\"$(get_date -2d)\",
162 \"Files\":[
163 {\"Filename\":\"file3.dat\",\"Size\":120},
164 {\"Filename\":\"file5.dat\",\"Size\":450},
165 {\"Filename\":\"file7.dat\",\"Size\":520},
166 {\"Filename\":\"file8.dat\",\"Size\":2048}]
167 }
168 ]" | lfstest-testutils addcommits
169
170 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. pushcustom.log
171 # use PIPESTATUS otherwise we get exit code from tee
172 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
173
174 # Make sure the lock verification is not attempted.
175 grepscip-shell system . . grep. "locks/verify$" pushcustom.log && falsescip-shell system . . false.
176
177 grepscip-shell system . . grep. "xfer: started custom adapter process" pushcustom.log
178 grepscip-shell system . . grep. "xfer\[lfstest-standalonecustomadapter\]:" pushcustom.log
179 grepscip-shell system . . grep. "Uploading LFS objects: 100% (12/12)" pushcustom.log
180
181 rmscip-shell system . . rm. -rf .git/lfs/objects
182 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. lfs fetch --all 2>&1 | teescip-shell system . . tee. fetchcustom.log
183 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
184
185 grepscip-shell system . . grep. "xfer: started custom adapter process" fetchcustom.log
186 grepscip-shell system . . grep. "xfer\[lfstest-standalonecustomadapter\]:" fetchcustom.log
187
188 grepscip-shell system . . grep. "Terminating test custom adapter gracefully" fetchcustom.log
189
190 # Test argument parsing.
191 grepscip-shell system . . grep. 'Saw argument "--arg1"' fetchcustom.log
192 grepscip-shell system . . grep. 'Saw argument "--arg2 --arg3"' fetchcustom.log
193 grepscip-shell system . . grep. 'Saw argument "--arg4"' fetchcustom.log
194
195 objectlist=`findscip-shell system . . find. .git/lfs/objects -type f`
196 [scip-shell system . . `[`. "$(echoscip-shell system . . echo. "$objectlist" | wcscip-shell system . . wc. -l)" -eq 12 ]
197
198 gitscip-shell system . . git. lfs fsck
199 )
200 end_test
201
202 begin_test "custom-transfer-standalone-urlmatch"
203 (
204 set -e
205
206 # setup a git repo to be used as a local repo, not remote
207 reponame="custom-transfer-standalone-urlmatch"
208 setup_remote_repo "$reponame"
209
210 # clone directly, not through lfstest-gitserver
211 clone_repo_url "$REMOTEDIR/$reponame.git" $reponame
212
213 # set up custom transfer adapter to use a specific transfer agent, using a URL prefix match
214 gitscip-shell system . . git. config lfs.customtransfer.testcustom.path lfstest-standalonecustomadapter
215 gitscip-shell system . . git. config lfs.customtransfer.testcustom.concurrent false
216 gitscip-shell system . . git. config remote.origin.lfsurl https://git.example.com/example/path/to/repo
217 gitscip-shell system . . git. config lfs.https://git.example.com/example/path/.standalonetransferagent testcustom
218 gitscip-shell system . . git. config lfs.standalonetransferagent invalid-agent
219
220 # git config lfs.standalonetransferagent testcustom
221 export TEST_STANDALONE_BACKUP_PATH="$(pwdscip-shell system . . pwd.)/test-custom-transfer-standalone-urlmatch-backup"
222 mkdirscip-shell system . . mkdir. -p $TEST_STANDALONE_BACKUP_PATH
223 rmscip-shell system . . rm. -rf $TEST_STANDALONE_BACKUP_PATH/*
224
225 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
226 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
227 gitscip-shell system . . git. add .gitattributes
228 gitscip-shell system . . git. commit -m "Tracking"
229
230 # set up a decent amount of data so that there's work for multiple concurrent adapters
231 echoscip-shell system . . echo. "[
232 {
233 \"CommitDate\":\"$(get_date -10d)\",
234 \"Files\":[
235 {\"Filename\":\"verify.dat\",\"Size\":18,\"Data\":\"send-verify-action\"},
236 {\"Filename\":\"file1.dat\",\"Size\":1024},
237 {\"Filename\":\"file2.dat\",\"Size\":750}]
238 },
239 {
240 \"CommitDate\":\"$(get_date -7d)\",
241 \"Files\":[
242 {\"Filename\":\"file1.dat\",\"Size\":1050},
243 {\"Filename\":\"file3.dat\",\"Size\":660},
244 {\"Filename\":\"file4.dat\",\"Size\":230}]
245 },
246 {
247 \"CommitDate\":\"$(get_date -5d)\",
248 \"Files\":[
249 {\"Filename\":\"file5.dat\",\"Size\":1200},
250 {\"Filename\":\"file6.dat\",\"Size\":300}]
251 },
252 {
253 \"CommitDate\":\"$(get_date -2d)\",
254 \"Files\":[
255 {\"Filename\":\"file3.dat\",\"Size\":120},
256 {\"Filename\":\"file5.dat\",\"Size\":450},
257 {\"Filename\":\"file7.dat\",\"Size\":520},
258 {\"Filename\":\"file8.dat\",\"Size\":2048}]
259 }
260 ]" | lfstest-testutils addcommits
261
262 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. pushcustom.log
263 # use PIPESTATUS otherwise we get exit code from tee
264 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
265
266 # Make sure the lock verification is not attempted.
267 grepscip-shell system . . grep. "locks/verify$" pushcustom.log && falsescip-shell system . . false.
268
269 grepscip-shell system . . grep. "xfer: started custom adapter process" pushcustom.log
270 grepscip-shell system . . grep. "xfer\[lfstest-standalonecustomadapter\]:" pushcustom.log
271 grepscip-shell system . . grep. "Uploading LFS objects: 100% (12/12)" pushcustom.log
272
273 rmscip-shell system . . rm. -rf .git/lfs/objects
274 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 gitscip-shell system . . git. lfs fetch --all 2>&1 | teescip-shell system . . tee. fetchcustom.log
275 [scip-shell system . . `[`. ${PIPESTATUS[0]} = "0" ]
276
277 grepscip-shell system . . grep. "xfer: started custom adapter process" fetchcustom.log
278 grepscip-shell system . . grep. "xfer\[lfstest-standalonecustomadapter\]:" fetchcustom.log
279
280 grepscip-shell system . . grep. "Terminating test custom adapter gracefully" fetchcustom.log
281
282 objectlist=`findscip-shell system . . find. .git/lfs/objects -type f`
283 [scip-shell system . . `[`. "$(echoscip-shell system . . echo. "$objectlist" | wcscip-shell system . . wc. -l)" -eq 12 ]
284
285 gitscip-shell system . . git. lfs fsck
286 )
287 end_test
288
289 begin_test "standalone agent without custom group (file transfers allowed)"
290 (
291 set -e
292
293 reponame="custom-transfer-standalone-valid-file"
294 setup_remote_repo "$reponame"
295
296 # Clone directly, not through lfstest-gitserver.
297 clone_repo_url "$REMOTEDIR/$reponame.git" "$reponame"
298
299 # When the remote has a file:// URL, we permit the standalone transfer
300 # agent to be set to the internal "lfs-standalone-file" adapter without
301 # any "lfs.customtransfer.*" settings.
302 gitscip-shell system . . git. config lfs.standaloneTransferAgent lfs-standalone-file
303
304 gitscip-shell system . . git. lfs track "*.bin"
305
306 contents="a"
307 contents_oid="$(calc_oid "$contents")"
308 printfscip-shell system . . printf. "%s" "$contents" >a.bin
309
310 gitscip-shell system . . git. add .gitattributes a.bin
311 gitscip-shell system . . git. commit -m "initial commit"
312
313 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
314 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
315
316 assert_remote_object "$reponame" "$contents_oid" "${#contents}"
317
318 rmscip-shell system . . rm. -rf .git/lfs/objects
319
320 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
321 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
322
323 [scip-shell system . . `[`. 0 -eq "$(grepscip-shell system . . grep. -c "not a registered custom transfer adapter" pull.log)" ]
324
325 assert_local_object "$contents_oid" "${#contents}"
326 )
327 end_test
328
329 begin_test "standalone agent without custom group (file transfers disallowed)"
330 (
331 set -e
332
333 reponame="custom-transfer-standalone-invalid-file"
334 setup_remote_repo "$reponame"
335 clone_repo "$reponame" "$reponame"
336
337 gitscip-shell system . . git. lfs track "*.bin"
338
339 contents="a"
340 contents_oid="$(calc_oid "$contents")"
341 printfscip-shell system . . printf. "%s" "$contents" >a.bin
342
343 gitscip-shell system . . git. add .gitattributes a.bin
344 gitscip-shell system . . git. commit -m "initial commit"
345
346 gitscip-shell system . . git. push origin main
347
348 # When the remote has an HTTP URL, we expect an error if the standalone
349 # transfer agent is set to the internal "lfs-standalone-file" adapter.
350 gitscip-shell system . . git. config lfs.standaloneTransferAgent lfs-standalone-file
351
352 rmscip-shell system . . rm. -rf .git/lfs/objects
353
354 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
355 [scip-shell system . . `[`. 0 -ne "${PIPESTATUS[0]}" ]
356
357 grepscip-shell system . . grep. "error initializing custom adapter \"lfs-standalone-file\"" pull.log
358 grepscip-shell system . . grep. "error creating handler: no valid file:// URLs found" pull.log
359 grepscip-shell system . . grep. "Failed to fetch some objects" pull.log
360
361 [scip-shell system . . `[`. 0 -eq "$(grepscip-shell system . . grep. -c "not a registered custom transfer adapter" pull.log)" ]
362
363 refute_local_object "$contents_oid"
364 )
365 end_test
366
367 begin_test "standalone agent without custom group ignored (basic transfers)"
368 (
369 set -e
370
371 reponame="custom-transfer-standalone-ignored-basic"
372 setup_remote_repo "$reponame"
373 clone_repo "$reponame" "$reponame"
374
375 # The standalone transfer agent should be ignored if it is set to the
376 # internal "basic" adapter, regardless of whether that adapter is
377 # actually used for HTTP requests to the Batch API.
378 gitscip-shell system . . git. config lfs.standaloneTransferAgent basic
379
380 gitscip-shell system . . git. lfs track "*.bin"
381
382 contents="a"
383 contents_oid="$(calc_oid "$contents")"
384 printfscip-shell system . . printf. "%s" "$contents" >a.bin
385
386 gitscip-shell system . . git. add .gitattributes a.bin
387 gitscip-shell system . . git. commit -m "initial commit"
388
389 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
390 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
391
392 grepscip-shell system . . grep. "standalone agent \"basic\" is not a registered custom transfer adapter; ignoring" push.log
393
394 assert_server_object "$reponame" "$contents_oid"
395
396 rmscip-shell system . . rm. -rf .git/lfs/objects
397
398 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
399 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
400
401 grepscip-shell system . . grep. "standalone agent \"basic\" is not a registered custom transfer adapter; ignoring" pull.log
402
403 assert_local_object "$contents_oid" "${#contents}"
404
405 # The standalone transfer agent should still be ignored even when
406 # a custom transfer adapter is registered with the same name as the
407 # internal "basic" adapter.
408 gitscip-shell system . . git. config lfs.customTransfer.basic.path path-to-nothing
409
410 contents="b"
411 contents_oid="$(calc_oid "$contents")"
412 printfscip-shell system . . printf. "%s" "$contents" >b.bin
413
414 gitscip-shell system . . git. add b.bin
415 gitscip-shell system . . git. commit -m "second commit"
416
417 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
418 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
419
420 grepscip-shell system . . grep. "standalone agent \"basic\" is not a registered custom transfer adapter; ignoring" push.log
421 grepscip-shell system . . grep. "custom upload transfer adapter \"basic\" ignored due to conflict with standard adapter" push.log
422 grepscip-shell system . . grep. "custom download transfer adapter \"basic\" ignored due to conflict with standard adapter" push.log
423
424 assert_server_object "$reponame" "$contents_oid"
425
426 rmscip-shell system . . rm. -rf .git/lfs/objects
427
428 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
429 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
430
431 grepscip-shell system . . grep. "standalone agent \"basic\" is not a registered custom transfer adapter; ignoring" pull.log
432 grepscip-shell system . . grep. "custom upload transfer adapter \"basic\" ignored due to conflict with standard adapter" pull.log
433 grepscip-shell system . . grep. "custom download transfer adapter \"basic\" ignored due to conflict with standard adapter" pull.log
434
435 assert_local_object "$contents_oid" "${#contents}"
436 )
437 end_test
438
439 begin_test "standalone agent without custom group ignored (basic transfers not ssh)"
440 (
441 set -e
442
443 reponame="custom-transfer-standalone-ignored-basic-ssh"
444 setup_remote_repo "$reponame"
445 clone_repo "$reponame" "$reponame"
446
447 # The standalone transfer agent should be ignored if it is set to the
448 # internal "ssh" adapter, regardless of whether the internal "basic"
449 # adapter will actually be used for HTTP requests to the Batch API.
450 gitscip-shell system . . git. config lfs.standaloneTransferAgent ssh
451
452 gitscip-shell system . . git. lfs track "*.bin"
453
454 contents="a"
455 contents_oid="$(calc_oid "$contents")"
456 printfscip-shell system . . printf. "%s" "$contents" >a.bin
457
458 gitscip-shell system . . git. add .gitattributes a.bin
459 gitscip-shell system . . git. commit -m "initial commit"
460
461 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
462 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
463
464 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" push.log
465
466 assert_server_object "$reponame" "$contents_oid"
467
468 rmscip-shell system . . rm. -rf .git/lfs/objects
469
470 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
471 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
472
473 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" pull.log
474
475 assert_local_object "$contents_oid" "${#contents}"
476
477 # The standalone transfer agent should still be ignored even when
478 # a custom transfer adapter is registered with the same name as the
479 # internal "ssh" adapter.
480 gitscip-shell system . . git. config lfs.customTransfer.ssh.path path-to-nothing
481
482 contents="b"
483 contents_oid="$(calc_oid "$contents")"
484 printfscip-shell system . . printf. "%s" "$contents" >b.bin
485
486 gitscip-shell system . . git. add b.bin
487 gitscip-shell system . . git. commit -m "second commit"
488
489 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
490 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
491
492 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" push.log
493 grepscip-shell system . . grep. "custom upload transfer adapter \"ssh\" ignored due to conflict with standard adapter" push.log
494 grepscip-shell system . . grep. "custom download transfer adapter \"ssh\" ignored due to conflict with standard adapter" push.log
495
496 assert_server_object "$reponame" "$contents_oid"
497
498 rmscip-shell system . . rm. -rf .git/lfs/objects
499
500 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
501 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
502
503 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" pull.log
504 grepscip-shell system . . grep. "custom upload transfer adapter \"ssh\" ignored due to conflict with standard adapter" pull.log
505 grepscip-shell system . . grep. "custom download transfer adapter \"ssh\" ignored due to conflict with standard adapter" pull.log
506
507 assert_local_object "$contents_oid" "${#contents}"
508 )
509 end_test
510
511 begin_test "standalone agent without custom group ignored (ssh transfers)"
512 (
513 set -e
514
515 setup_pure_ssh
516
517 reponame="custom-transfer-standalone-ignored-ssh"
518 setup_remote_repo "$reponame"
519 clone_repo "$reponame" "$reponame"
520
521 sshurl=$(ssh_remote "$reponame")
522 gitscip-shell system . . git. config lfs.url "$sshurl"
523
524 # The standalone transfer agent should be ignored if it is set to the
525 # internal "ssh" adapter, regardless of whether that adapter is
526 # actually used for SSH requests to the Batch API.
527 gitscip-shell system . . git. config lfs.standaloneTransferAgent ssh
528
529 gitscip-shell system . . git. lfs track "*.bin"
530
531 contents="a"
532 contents_oid="$(calc_oid "$contents")"
533 printfscip-shell system . . printf. "%s" "$contents" >a.bin
534
535 gitscip-shell system . . git. add .gitattributes a.bin
536 gitscip-shell system . . git. commit -m "initial commit"
537
538 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
539 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
540
541 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" push.log
542
543 assert_remote_object "$reponame" "$contents_oid" "${#contents}"
544
545 rmscip-shell system . . rm. -rf .git/lfs/objects
546
547 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
548 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
549
550 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" pull.log
551
552 assert_local_object "$contents_oid" "${#contents}"
553
554 # The standalone transfer agent should still be ignored even when
555 # a custom transfer adapter is registered with the same name as the
556 # internal "ssh" adapter.
557 gitscip-shell system . . git. config lfs.customTransfer.ssh.path path-to-nothing
558
559 contents="b"
560 contents_oid="$(calc_oid "$contents")"
561 printfscip-shell system . . printf. "%s" "$contents" >b.bin
562
563 gitscip-shell system . . git. add b.bin
564 gitscip-shell system . . git. commit -m "second commit"
565
566 GIT_TRACE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
567 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
568
569 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" push.log
570 grepscip-shell system . . grep. "custom upload transfer adapter \"ssh\" ignored due to conflict with standard adapter" push.log
571 grepscip-shell system . . grep. "custom download transfer adapter \"ssh\" ignored due to conflict with standard adapter" push.log
572
573 assert_remote_object "$reponame" "$contents_oid" "${#contents}"
574
575 rmscip-shell system . . rm. -rf .git/lfs/objects
576
577 GIT_TRACE=1 gitscip-shell system . . git. lfs pull 2>&1 | teescip-shell system . . tee. pull.log
578 [scip-shell system . . `[`. 0 -eq "${PIPESTATUS[0]}" ]
579
580 grepscip-shell system . . grep. "standalone agent \"ssh\" is not a registered custom transfer adapter; ignoring" pull.log
581 grepscip-shell system . . grep. "custom upload transfer adapter \"ssh\" ignored due to conflict with standard adapter" pull.log
582 grepscip-shell system . . grep. "custom download transfer adapter \"ssh\" ignored due to conflict with standard adapter" pull.log
583
584 assert_local_object "$contents_oid" "${#contents}"
585 )
586 end_test