Debian Codegraph @

t/t-clone.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 ensure_git_version_isnt $VERSION_LOWER "2.2.0"
6
7 export CREDSDIR="$REMOTEDIR/creds-clone"
8 setup_creds
9
10 begin_test "clone"
11 (
12 set -e
13
14 reponame="$(basenamescip-shell system . . basename. "$0" ".sh")"
15 setup_remote_repo "$reponame"
16 clone_repo "$reponame" repo
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 gitscip-shell system . . git. add .gitattributes
21 gitscip-shell system . . git. commit -m "Track *.dat"
22
23 # generate some test data & commits with random LFS data
24 echoscip-shell system . . echo. "[
25 {
26 \"CommitDate\":\"$(get_date -10d)\",
27 \"Files\":[
28 {\"Filename\":\"file1.dat\",\"Size\":100},
29 {\"Filename\":\"file2.dat\",\"Size\":75}]
30 },
31 {
32 \"CommitDate\":\"$(get_date -7d)\",
33 \"Files\":[
34 {\"Filename\":\"file1.dat\",\"Size\":110},
35 {\"Filename\":\"file3.dat\",\"Size\":66},
36 {\"Filename\":\"file4.dat\",\"Size\":23}]
37 },
38 {
39 \"CommitDate\":\"$(get_date -10d)\",
40 \"Files\":[
41 {\"Filename\":\"file5.dat\",\"Size\":120},
42 {\"Filename\":\"file6.dat\",\"Size\":30}]
43 }
44 ]" | lfstest-testutils addcommits
45
46 gitscip-shell system . . git. push origin main
47
48 # Now clone again, test specific clone dir
49 cd "$TRASHDIR"
50
51 newclonedir="testclone1"
52 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$newclonedir" 2>&1 | teescip-shell system . . tee. lfsclone.log
53 grepscip-shell system . . grep. "Cloning into" lfsclone.log
54 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
55 # should be no filter errors
56 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
57 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
58 # should be cloned into location as per arg
59 [scip-shell system . . `[`. -d "$newclonedir" ]
60
61 # check a few file sizes to make sure pulled
62 pushd "$newclonedir"
63 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 110 ]
64 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
65 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 66 ]
66 assert_hooks "$(dot_git_dir)"
67 [scip-shell system . . `[`. ! -e "lfs" ]
68 assert_clean_status
69 popd
70
71 # Now check clone with implied dir
72 rmscip-shell system . . rm. -rf "$reponame"
73 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. lfsclone.log
74 grepscip-shell system . . grep. "Cloning into" lfsclone.log
75 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
76 # should be no filter errors
77 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
78 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
79 # clone location should be implied
80 [scip-shell system . . `[`. -d "$reponame" ]
81
82 pushd "$reponame"
83 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 110 ]
84 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
85 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 66 ]
86 assert_hooks "$(dot_git_dir)"
87 [scip-shell system . . `[`. ! -e "lfs" ]
88 assert_clean_status
89 popd
90
91 # Now check clone with standard 'git clone' and smudge download
92 rmscip-shell system . . rm. -rf "$reponame"
93 gitscip-shell system . . git. clone "$GITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. clone.log
94 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
95 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
96 exit 1
97 fi
98 grepscip-shell system . . grep. "Cloning into" clone.log
99 [scip-shell system . . `[`. -d "$reponame" ]
100
101 pushd "$reponame"
102 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 110 ]
103 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
104 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 66 ]
105 assert_hooks "$(dot_git_dir)"
106 [scip-shell system . . `[`. ! -e "lfs" ]
107 [scip-shell system . . `[`. "6" -eq "$(findscip-shell system . . find. "$(dot_git_dir)/lfs/objects" -type f | wcscip-shell system . . wc. -l)" ]
108 assert_clean_status
109 popd
110 )
111 end_test
112
113 begin_test "cloneSSL"
114 (
115 set -e
116
117 if [scip-shell system . . `[`. "$IS_WINDOWS" -eq 1 ]; then
118 gitscip-shell system . . git. config --global "http.sslBackend" "openssl"
119 fi
120
121 reponame="test-cloneSSL"
122 setup_remote_repo "$reponame"
123 clone_repo_ssl "$reponame" "$reponame"
124
125 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
126 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
127 gitscip-shell system . . git. add .gitattributes
128 gitscip-shell system . . git. commit -m "Track *.dat"
129
130 # generate some test data & commits with random LFS data
131 echoscip-shell system . . echo. "[
132 {
133 \"CommitDate\":\"$(get_date -5d)\",
134 \"Files\":[
135 {\"Filename\":\"file1.dat\",\"Size\":100},
136 {\"Filename\":\"file2.dat\",\"Size\":75}]
137 },
138 {
139 \"CommitDate\":\"$(get_date -1d)\",
140 \"Files\":[
141 {\"Filename\":\"file3.dat\",\"Size\":30}]
142 }
143 ]" | lfstest-testutils addcommits
144
145 gitscip-shell system . . git. push origin main
146
147 # Now SSL clone again with 'git lfs clone', test specific clone dir
148 cd "$TRASHDIR"
149
150 newclonedir="testcloneSSL1"
151 gitscip-shell system . . git. lfs clone "$SSLGITSERVER/$reponame" "$newclonedir" 2>&1 | teescip-shell system . . tee. lfsclone.log
152 grepscip-shell system . . grep. "Cloning into" lfsclone.log
153 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
154 # should be no filter errors
155 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
156 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
157 # should be cloned into location as per arg
158 [scip-shell system . . `[`. -d "$newclonedir" ]
159
160 # check a few file sizes to make sure pulled
161 pushd "$newclonedir"
162 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
163 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
164 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
165 assert_hooks "$(dot_git_dir)"
166 [scip-shell system . . `[`. ! -e "lfs" ]
167 assert_clean_status
168 popd
169
170 # Now check SSL clone with standard 'git clone' and smudge download
171 rmscip-shell system . . rm. -rf "$reponame"
172 gitscip-shell system . . git. clone "$SSLGITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. clone.log
173 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
174 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
175 exit 1
176 fi
177 grepscip-shell system . . grep. "Cloning into" clone.log
178 [scip-shell system . . `[`. -d "$reponame" ]
179
180 pushd "$reponame"
181 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
182 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
183 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
184 assert_hooks "$(dot_git_dir)"
185 [scip-shell system . . `[`. ! -e "lfs" ]
186 [scip-shell system . . `[`. "3" -eq "$(findscip-shell system . . find. "$(dot_git_dir)/lfs/objects" -type f | wcscip-shell system . . wc. -l)" ]
187 assert_clean_status
188 popd
189 )
190 end_test
191
192 begin_test "clone ClientCert"
193 (
194 set -e
195
196 if [scip-shell system . . `[`. "$IS_WINDOWS" -eq 1 ]; then
197 gitscip-shell system . . git. config --global "http.sslBackend" "openssl"
198 fi
199
200 # Note that the record files we create in the $CREDSDIR directory are not
201 # used until we set the "http.sslCertPasswordProtected" option to "true"
202 # and the "http.<url>.sslKey" option with the path to our TLS/SSL client
203 # certificate's encrypted private key file. (The PEM certificate file
204 # itself is not encrypted and does not contain the private key.)
205 #
206 # When these options are set, however, Git and Git LFS will independently
207 # invoke "git credential fill" to retrieve the passphrase for the
208 # encrypted private key. Because the "http.sslCertPasswordProtected"
209 # option is set, Git will query the credential helper, passing a
210 # "protocol=cert" line and a "path=<certfile>" line with the path
211 # from the "http.<url>.sslCert" option. Note that this path refers
212 # to our unencrypted certificate file; Git does not use the path to
213 # the encrypted private key file from the "http.<url>.sslKey" option
214 # in its query to the credential helper.
215 #
216 # Separately, the Git LFS client will detect that the private key file
217 # specified by the "http.<url>.sslKey" option is encrypted, and so will
218 # invoke "git credential fill" to retrieve its passphrase, passing a
219 # "protocol=cert" line and a "path=<keyfile>" line with the path
220 # from the "http.<url>.sslKey" option.
221 #
222 # In order to satisfy both requests, our git-credential-lfstest helper
223 # therefore needs two record files, both with the passphrase for the
224 # encrypted private key file. For Git, one is associated with the path
225 # to the certificate file, and for Git LFS, one is associated with the
226 # path to the key file.
227 write_creds_file "::pass" "$CREDSDIR/--$(echoscip-shell system . . echo. "$LFS_CLIENT_CERT_FILE" | trscip-shell system . . tr. /scip-shell filesystem . . `/`. -)"
228 write_creds_file "::pass" "$CREDSDIR/--$(echoscip-shell system . . echo. "$LFS_CLIENT_KEY_FILE_ENCRYPTED" | trscip-shell system . . tr. /scip-shell filesystem . . `/`. -)"
229
230 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslCert" "$LFS_CLIENT_CERT_FILE"
231 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslKey" "$LFS_CLIENT_KEY_FILE"
232
233 reponame="test-cloneClientCert"
234 setup_remote_repo "$reponame"
235 clone_repo_clientcert "$reponame" "$reponame"
236
237 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
238 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
239 gitscip-shell system . . git. add .gitattributes
240 gitscip-shell system . . git. commit -m "Track *.dat"
241
242 # generate some test data & commits with random LFS data
243 echoscip-shell system . . echo. "[
244 {
245 \"CommitDate\":\"$(get_date -5d)\",
246 \"Files\":[
247 {\"Filename\":\"file1.dat\",\"Size\":100},
248 {\"Filename\":\"file2.dat\",\"Size\":75}]
249 },
250 {
251 \"CommitDate\":\"$(get_date -1d)\",
252 \"Files\":[
253 {\"Filename\":\"file3.dat\",\"Size\":30}]
254 }
255 ]" | lfstest-testutils addcommits
256
257 gitscip-shell system . . git. push origin main
258
259 # Now clone again with 'git lfs clone', test specific clone dir
260 # Test with both unencrypted and encrypted client certificate keys
261 cd "$TRASHDIR"
262
263 for enc in "false" "true"; do
264 if [scip-shell system . . `[`. "$enc" = "true" ]; then
265 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslKey" "$LFS_CLIENT_KEY_FILE_ENCRYPTED"
266 gitscip-shell system . . git. config --global "http.sslCertPasswordProtected" "$enc"
267 fi
268
269 newclonedir="${reponame}-${enc}"
270 gitscip-shell system . . git. lfs clone "$CLIENTCERTGITSERVER/$reponame" "$newclonedir" 2>&1 | teescip-shell system . . tee. lfsclone.log
271 grepscip-shell system . . grep. "Cloning into" lfsclone.log
272 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
273 # should be no filter errors
274 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
275 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
276 # should be cloned into location as per arg
277 [scip-shell system . . `[`. -d "$newclonedir" ]
278
279 # check a few file sizes to make sure pulled
280 pushd "$newclonedir"
281 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
282 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
283 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
284 assert_hooks "$(dot_git_dir)"
285 [scip-shell system . . `[`. ! -e "lfs" ]
286 assert_clean_status
287 popd
288
289 # Now check clone with standard 'git clone' and smudge download
290 rmscip-shell system . . rm. -rf "$reponame"
291 gitscip-shell system . . git. clone "$CLIENTCERTGITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. clone.log
292 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
293 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
294 exit 1
295 fi
296 grepscip-shell system . . grep. "Cloning into" clone.log
297 [scip-shell system . . `[`. -d "$reponame" ]
298
299 pushd "$reponame"
300 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
301 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
302 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
303 assert_hooks "$(dot_git_dir)"
304 [scip-shell system . . `[`. ! -e "lfs" ]
305 [scip-shell system . . `[`. "3" -eq "$(findscip-shell system . . find. "$(dot_git_dir)/lfs/objects" -type f | wcscip-shell system . . wc. -l)" ]
306 assert_clean_status
307 popd
308 done
309 )
310 end_test
311
312 begin_test "clone ClientCert with homedir certs"
313 (
314 set -e
315
316 if [scip-shell system . . `[`. "$IS_WINDOWS" -eq 1 ]; then
317 gitscip-shell system . . git. config --global "http.sslBackend" "openssl"
318 fi
319
320 cpscip-shell system . . cp. "$LFS_CLIENT_CERT_FILE" "$HOME/lfs-client-cert-file"
321 cpscip-shell system . . cp. "$LFS_CLIENT_KEY_FILE" "$HOME/lfs-client-key-file"
322 cpscip-shell system . . cp. "$LFS_CLIENT_KEY_FILE_ENCRYPTED" "$HOME/lfs-client-key-file-encrypted"
323
324 # Note that the record files we create in the $CREDSDIR directory are not
325 # used until we set the "http.sslCertPasswordProtected" option to "true"
326 # and the "http.<url>.sslKey" option with the path to our TLS/SSL client
327 # certificate's encrypted private key file. (The PEM certificate file
328 # itself is not encrypted and does not contain the private key.)
329 #
330 # When these options are set, however, Git and Git LFS will independently
331 # invoke "git credential fill" to retrieve the passphrase for the
332 # encrypted private key. Because the "http.sslCertPasswordProtected"
333 # option is set, Git will query the credential helper, passing a
334 # "protocol=cert" line and a "path=<certfile>" line with the path
335 # from the "http.<url>.sslCert" option. Note that this path refers
336 # to our unencrypted certificate file; Git does not use the path to
337 # the encrypted private key file from the "http.<url>.sslKey" option
338 # in its query to the credential helper.
339 #
340 # Separately, the Git LFS client will detect that the private key file
341 # specified by the "http.<url>.sslKey" option is encrypted, and so will
342 # invoke "git credential fill" to retrieve its passphrase, passing a
343 # "protocol=cert" line and a "path=<keyfile>" line with the path
344 # from the "http.<url>.sslKey" option.
345 #
346 # In order to satisfy both requests, our git-credential-lfstest helper
347 # therefore needs two record files, both with the passphrase for the
348 # encrypted private key file. For Git, one is associated with the path
349 # to the certificate file, and for Git LFS, one is associated with the
350 # path to the key file.
351 if [scip-shell system . . `[`. "$IS_WINDOWS" -eq 1 ]; then
352 # In our MSYS2 CI environment we have to convert the Unix-style path
353 # in $HOME, which starts with /tmp/, into a path of the form /a/...
354 # so that the credential record filename we create from it matches
355 # the one our git-credential-lfstest helper will construct from the
356 # "path" values it receives from Git and Git LFS.
357 homedir="$(cygpath -m "$HOME" | sedscip-shell system . . sed. 's,^\([A-Z]\):,/\L\1,')"
358 else
359 homedir="$HOME"
360 fi
361 write_creds_file "::pass" "$CREDSDIR/--$(echoscip-shell system . . echo. "$homedir/lfs-client-cert-file" | trscip-shell system . . tr. /scip-shell filesystem . . `/`. -)"
362 write_creds_file "::pass" "$CREDSDIR/--$(echoscip-shell system . . echo. "$homedir/lfs-client-key-file-encrypted" | trscip-shell system . . tr. /scip-shell filesystem . . `/`. -)"
363
364 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslCert" "~/lfs-client-cert-file"
365 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslKey" "~/lfs-client-key-file"
366
367 reponame="test-cloneClientCert-homedir"
368 setup_remote_repo "$reponame"
369 clone_repo_clientcert "$reponame" "$reponame"
370
371 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
372 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
373 gitscip-shell system . . git. add .gitattributes
374 gitscip-shell system . . git. commit -m "Track *.dat"
375
376 # generate some test data & commits with random LFS data
377 echoscip-shell system . . echo. "[
378 {
379 \"CommitDate\":\"$(get_date -5d)\",
380 \"Files\":[
381 {\"Filename\":\"file1.dat\",\"Size\":100},
382 {\"Filename\":\"file2.dat\",\"Size\":75}]
383 },
384 {
385 \"CommitDate\":\"$(get_date -1d)\",
386 \"Files\":[
387 {\"Filename\":\"file3.dat\",\"Size\":30}]
388 }
389 ]" | lfstest-testutils addcommits
390
391 gitscip-shell system . . git. push origin main
392
393 # Now clone again with 'git lfs clone', test specific clone dir
394 # Test with both unencrypted and encrypted client certificate keys
395 cd "$TRASHDIR"
396
397 for enc in "false" "true"; do
398 if [scip-shell system . . `[`. "$enc" = "true" ]; then
399 gitscip-shell system . . git. config --global "http.$LFS_CLIENT_CERT_URL/.sslKey" "~/lfs-client-key-file-encrypted"
400 gitscip-shell system . . git. config --global "http.sslCertPasswordProtected" "$enc"
401 fi
402
403 newclonedir="${reponame}-${enc}"
404 gitscip-shell system . . git. lfs clone "$CLIENTCERTGITSERVER/$reponame" "$newclonedir" 2>&1 | teescip-shell system . . tee. lfsclone.log
405 grepscip-shell system . . grep. "Cloning into" lfsclone.log
406 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
407 # should be no filter errors
408 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
409 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
410 # should be cloned into location as per arg
411 [scip-shell system . . `[`. -d "$newclonedir" ]
412
413 # check a few file sizes to make sure pulled
414 pushd "$newclonedir"
415 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
416 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
417 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
418 assert_hooks "$(dot_git_dir)"
419 [scip-shell system . . `[`. ! -e "lfs" ]
420 assert_clean_status
421 popd
422
423 # Now check clone with standard 'git clone' and smudge download
424 rmscip-shell system . . rm. -rf "$reponame"
425 gitscip-shell system . . git. clone "$CLIENTCERTGITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. clone.log
426 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
427 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
428 exit 1
429 fi
430 grepscip-shell system . . grep. "Cloning into" clone.log
431 [scip-shell system . . `[`. -d "$reponame" ]
432
433 pushd "$reponame"
434 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 100 ]
435 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
436 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 30 ]
437 assert_hooks "$(dot_git_dir)"
438 [scip-shell system . . `[`. ! -e "lfs" ]
439 [scip-shell system . . `[`. "3" -eq "$(findscip-shell system . . find. "$(dot_git_dir)/lfs/objects" -type f | wcscip-shell system . . wc. -l)" ]
440 assert_clean_status
441 popd
442 done
443 )
444 end_test
445
446 begin_test "clone with flags"
447 (
448 set -e
449
450 reponame="$(basenamescip-shell system . . basename. "$0" ".sh")-flags"
451 setup_remote_repo "$reponame"
452 clone_repo "$reponame" "$reponame"
453
454 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
455 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
456 gitscip-shell system . . git. add .gitattributes
457 gitscip-shell system . . git. commit -m "Track *.dat"
458
459 # generate some test data & commits with random LFS data
460 echoscip-shell system . . echo. "[
461 {
462 \"CommitDate\":\"$(get_date -10d)\",
463 \"Files\":[
464 {\"Filename\":\"file1.dat\",\"Size\":100},
465 {\"Filename\":\"file2.dat\",\"Size\":75}]
466 },
467 {
468 \"CommitDate\":\"$(get_date -7d)\",
469 \"NewBranch\":\"branch2\",
470 \"Files\":[
471 {\"Filename\":\"fileonbranch2.dat\",\"Size\":66}]
472 },
473 {
474 \"CommitDate\":\"$(get_date -3d)\",
475 \"ParentBranches\":[\"main\"],
476 \"Files\":[
477 {\"Filename\":\"file3.dat\",\"Size\":120},
478 {\"Filename\":\"file4.dat\",\"Size\":30}]
479 }
480 ]" | lfstest-testutils addcommits
481
482 gitscip-shell system . . git. push origin main branch2
483
484 # Now clone again, test specific clone dir
485 cd "$TRASHDIR"
486 mkdirscip-shell system . . mkdir. "$TRASHDIR/templatedir"
487
488 newclonedir="testflagsclone1"
489 # many of these flags won't do anything but make sure they're not rejected
490 gitscip-shell system . . git. lfs clone --template "$TRASHDIR/templatedir" --local --no-hardlinks --shared --verbose --progress --recursive "$GITSERVER/$reponame" "$newclonedir"
491 rmscip-shell system . . rm. -rf "$newclonedir"
492
493 # specific test for --no-checkout
494 gitscip-shell system . . git. lfs clone --quiet --no-checkout "$GITSERVER/$reponame" "$newclonedir"
495 if [scip-shell system . . `[`. -e "$newclonedir/file1.dat" ]; then
496 exit 1
497 fi
498 rmscip-shell system . . rm. -rf "$newclonedir"
499
500 # specific test for --branch and --origin
501 gitscip-shell system . . git. lfs clone --branch branch2 --recurse-submodules --origin differentorigin "$GITSERVER/$reponame" "$newclonedir"
502 pushd "$newclonedir"
503 # this file is only on branch2
504 [scip-shell system . . `[`. -e "fileonbranch2.dat" ]
505 # confirm remote is called differentorigin
506 gitscip-shell system . . git. remote get-url differentorigin
507 assert_hooks "$(dot_git_dir)"
508 [scip-shell system . . `[`. ! -e "lfs" ]
509 assert_clean_status
510 popd
511 rmscip-shell system . . rm. -rf "$newclonedir"
512
513 # specific test for --separate-git-dir
514 gitdir="$TRASHDIR/separategitdir"
515 gitscip-shell system . . git. lfs clone --separate-git-dir "$gitdir" "$GITSERVER/$reponame" "$newclonedir"
516 # .git should be a file not dir
517 if [scip-shell system . . `[`. -d "$newclonedir/.git" ]; then
518 exit 1
519 fi
520 [scip-shell system . . `[`. -e "$newclonedir/.git" ]
521 [scip-shell system . . `[`. -d "$gitdir/objects" ]
522 assert_hooks "$gitdir"
523 pushd "$newclonedir"
524 [scip-shell system . . `[`. ! -e "lfs" ]
525 assert_clean_status
526 popd
527 rmscip-shell system . . rm. -rf "$newclonedir"
528 rmscip-shell system . . rm. -rf "$gitdir"
529
530 # specific test for --bare
531 gitscip-shell system . . git. lfs clone --bare "$GITSERVER/$reponame" "$newclonedir"
532 [scip-shell system . . `[`. -d "$newclonedir/objects" ]
533 rmscip-shell system . . rm. -rf "$newclonedir"
534
535 # short flags
536 gitscip-shell system . . git. lfs clone -l -v -n -s -b branch2 "$GITSERVER/$reponame" "$newclonedir"
537 rmscip-shell system . . rm. -rf "$newclonedir"
538 )
539 end_test
540
541 begin_test "clone (with include/exclude args)"
542 (
543 set -e
544
545 reponame="clone_include_exclude"
546 setup_remote_repo "$reponame"
547 clone_repo "$reponame" "$reponame"
548
549 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
550 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
551
552 contents_a="a"
553 contents_a_oid=$(calc_oid "$contents_a")
554 printfscip-shell system . . printf. "%s" "$contents_a" > "a.dat"
555 printfscip-shell system . . printf. "%s" "$contents_a" > "a-dupe.dat"
556 printfscip-shell system . . printf. "%s" "$contents_a" > "dupe-a.dat"
557
558 contents_b="b"
559 contents_b_oid=$(calc_oid "$contents_b")
560 printfscip-shell system . . printf. "%s" "$contents_b" > "b.dat"
561
562 gitscip-shell system . . git. add *.dat .gitattributes
563 gitscip-shell system . . git. commit -m "add a.dat, b.dat" 2>&1 | teescip-shell system . . tee. commit.log
564 grepscip-shell system . . grep. "main (root-commit)" commit.log
565 grepscip-shell system . . grep. "5 files changed" commit.log
566 grepscip-shell system . . grep. "create mode 100644 a.dat" commit.log
567 grepscip-shell system . . grep. "create mode 100644 a-dupe.dat" commit.log
568 grepscip-shell system . . grep. "create mode 100644 dupe-a.dat" commit.log
569 grepscip-shell system . . grep. "create mode 100644 b.dat" commit.log
570 grepscip-shell system . . grep. "create mode 100644 .gitattributes" commit.log
571
572 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
573 grepscip-shell system . . grep. "main -> main" push.log
574 grepscip-shell system . . grep. "Uploading LFS objects: 100% (2/2), 2 B" push.log
575
576 cd "$TRASHDIR"
577
578 local_reponame="clone_with_includes"
579 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame" -I "a*.dat"
580 pushd "$local_reponame"
581 assert_local_object "$contents_a_oid" 1
582 refute_local_object "$contents_b_oid"
583 [scip-shell system . . `[`. "a" = "$(catscip-shell system . . cat. a.dat)" ]
584 [scip-shell system . . `[`. "a" = "$(catscip-shell system . . cat. a-dupe.dat)" ]
585 [scip-shell system . . `[`. "$(pointer $contents_a_oid 1)" = "$(catscip-shell system . . cat. dupe-a.dat)" ]
586 [scip-shell system . . `[`. "$(pointer $contents_b_oid 1)" = "$(catscip-shell system . . cat. b.dat)" ]
587 assert_hooks "$(dot_git_dir)"
588 [scip-shell system . . `[`. ! -e "lfs" ]
589 assert_clean_status
590 popd
591
592 local_reponame="clone_with_excludes"
593 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame" -I "b.dat" -X "a.dat"
594 pushd "$local_reponame"
595 assert_local_object "$contents_b_oid" 1
596 refute_local_object "$contents_a_oid"
597 [scip-shell system . . `[`. "$(pointer $contents_a_oid 1)" = "$(catscip-shell system . . cat. a.dat)" ]
598 [scip-shell system . . `[`. "b" = "$(catscip-shell system . . cat. b.dat)" ]
599 assert_hooks "$(dot_git_dir)"
600 [scip-shell system . . `[`. ! -e "lfs" ]
601 assert_clean_status
602 popd
603 )
604 end_test
605
606 begin_test "clone (with .lfsconfig)"
607 (
608 set -e
609
610 reponame="clone_with_lfsconfig"
611 setup_remote_repo "$reponame"
612 clone_repo "$reponame" "$reponame"
613
614 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
615 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
616
617 contents_a="a"
618 contents_a_oid=$(calc_oid "$contents_a")
619 printfscip-shell system . . printf. "%s" "$contents_a" > "a.dat"
620
621 contents_b="b"
622 contents_b_oid=$(calc_oid "$contents_b")
623 printfscip-shell system . . printf. "%s" "$contents_b" > "b.dat"
624
625 gitscip-shell system . . git. add a.dat b.dat .gitattributes
626 gitscip-shell system . . git. commit -m "add a.dat, b.dat" 2>&1 | teescip-shell system . . tee. commit.log
627 grepscip-shell system . . grep. "main (root-commit)" commit.log
628 grepscip-shell system . . grep. "3 files changed" commit.log
629 grepscip-shell system . . grep. "create mode 100644 a.dat" commit.log
630 grepscip-shell system . . grep. "create mode 100644 b.dat" commit.log
631 grepscip-shell system . . grep. "create mode 100644 .gitattributes" commit.log
632
633 gitscip-shell system . . git. config -f ".lfsconfig" "lfs.fetchinclude" "a*"
634 gitscip-shell system . . git. add ".lfsconfig"
635 gitscip-shell system . . git. commit -m "config lfs.fetchinclude a*" 2>&1 | teescip-shell system . . tee. commit.log
636 grepscip-shell system . . grep. "main" commit.log
637 grepscip-shell system . . grep. "1 file changed" commit.log
638 grepscip-shell system . . grep. "create mode 100644 .lfsconfig" commit.log
639
640 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
641 grepscip-shell system . . grep. "main -> main" push.log
642 grepscip-shell system . . grep. "Uploading LFS objects: 100% (2/2), 2 B" push.log
643
644 pushd "$TRASHDIR"
645
646 echoscip-shell system . . echo. "test: clone with lfs.fetchinclude in .lfsconfig"
647 local_reponame="clone_with_config_include"
648 set +x
649 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame"
650 ok="$?"
651 set -x
652 if [scip-shell system . . `[`. "0" -ne "$ok" ]; then
653 # TEMP: used to catch transient failure from above `clone` command, as in:
654 # https://github.com/git-lfs/git-lfs/pull/1782#issuecomment-267678319
655 echoscip-shell system . . echo. >&2 "[!] \`git lfs clone $GITSERVER/$reponame $local_reponame\` failed"
656 gitscip-shell system . . git. lfs logs last
657
658 exit 1
659 fi
660 pushd "$local_reponame"
661 assert_local_object "$contents_a_oid" 1
662 refute_local_object "$contents_b_oid"
663 assert_hooks "$(dot_git_dir)"
664 [scip-shell system . . `[`. ! -e "lfs" ]
665 assert_clean_status
666 popd
667
668 echoscip-shell system . . echo. "test: clone with lfs.fetchinclude in .lfsconfig, and args"
669 local_reponame="clone_with_config_include_and_args"
670 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame" -I "b.dat"
671 pushd "$local_reponame"
672 refute_local_object "$contents_a_oid"
673 assert_local_object "$contents_b_oid" 1
674 assert_hooks "$(dot_git_dir)"
675 [scip-shell system . . `[`. ! -e "lfs" ]
676 assert_clean_status
677 popd
678
679 popd
680
681 gitscip-shell system . . git. config -f ".lfsconfig" "lfs.fetchinclude" "b*"
682 gitscip-shell system . . git. config -f ".lfsconfig" "lfs.fetchexclude" "a*"
683 gitscip-shell system . . git. add .lfsconfig
684 gitscip-shell system . . git. commit -m "config lfs.fetchinclude a*" 2>&1 | teescip-shell system . . tee. commit.log
685 grepscip-shell system . . grep. "main" commit.log
686 grepscip-shell system . . grep. "1 file changed" commit.log
687 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
688 grepscip-shell system . . grep. "main -> main" push.log
689
690 pushd "$TRASHDIR"
691
692 echoscip-shell system . . echo. "test: clone with lfs.fetchexclude in .lfsconfig"
693 local_reponame="clone_with_config_exclude"
694 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame"
695 pushd "$local_reponame"
696 catscip-shell system . . cat. ".lfsconfig"
697 assert_local_object "$contents_b_oid" 1
698 refute_local_object "$contents_a_oid"
699 assert_hooks "$(dot_git_dir)"
700 [scip-shell system . . `[`. ! -e "lfs" ]
701 assert_clean_status
702 popd
703
704 echoscip-shell system . . echo. "test: clone with lfs.fetchexclude in .lfsconfig, and args"
705 local_reponame="clone_with_config_exclude_and_args"
706 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame" -I "a.dat" -X "b.dat"
707 pushd "$local_reponame"
708 assert_local_object "$contents_a_oid" 1
709 refute_local_object "$contents_b_oid"
710 assert_hooks "$(dot_git_dir)"
711 [scip-shell system . . `[`. ! -e "lfs" ]
712 assert_clean_status
713 popd
714
715 popd
716 )
717 end_test
718
719 begin_test "clone (without clean filter)"
720 (
721 set -e
722
723 reponame="clone_with_clean"
724 setup_remote_repo "$reponame"
725 clone_repo "$reponame" "$reponame"
726
727 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
728 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
729
730 contents_a="a"
731 contents_a_oid=$(calc_oid "$contents_a")
732 printfscip-shell system . . printf. "%s" "$contents_a" > "a.dat"
733
734 gitscip-shell system . . git. add *.dat .gitattributes
735 gitscip-shell system . . git. commit -m "add a.dat, b.dat" 2>&1 | teescip-shell system . . tee. commit.log
736 grepscip-shell system . . grep. "main (root-commit)" commit.log
737
738 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
739 grepscip-shell system . . grep. "main -> main" push.log
740 grepscip-shell system . . grep. "Uploading LFS objects: 100% (1/1), 1 B" push.log
741
742 cd "$TRASHDIR"
743
744 gitscip-shell system . . git. lfs uninstall
745 gitscip-shell system . . git. config --list > config.txt
746 grepscip-shell system . . grep. "filter.lfs.clean" config.txt && {
747 echoscip-shell system . . echo. "clean filter still configured:"
748 catscip-shell system . . cat. config.txt
749 exit 1
750 }
751
752 local_reponame="clone_without_clean"
753 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$local_reponame" -I "a*.dat" | teescip-shell system . . tee. clone.txt
754 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
755 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
756 exit 1
757 fi
758 grepscip-shell system . . grep. "Git LFS is not installed" clone.txt
759
760 cd "$local_reponame"
761 assert_local_object "$contents_a_oid" 1
762 [scip-shell system . . `[`. "$(pointer $contents_a_oid 1)" = "$(catscip-shell system . . cat. a.dat)" ]
763 )
764 end_test
765
766 begin_test "clone with submodules"
767 (
768 set -e
769
770 # set up a doubly nested submodule, each with LFS content
771 reponame="submod-root"
772 submodname1="submod-level1"
773 submodname2="submod-level2"
774
775 setup_remote_repo "$reponame"
776 setup_remote_repo "$submodname1"
777 setup_remote_repo "$submodname2"
778
779 clone_repo "$submodname2" submod2
780 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
781 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
782
783 contents_sub2="Inception. Now, before you bother telling me it's impossible..."
784 contents_sub2_oid=$(calc_oid "$contents_sub2")
785 printfscip-shell system . . printf. "%s" "$contents_sub2" > "sub2.dat"
786 gitscip-shell system . . git. add sub2.dat .gitattributes
787 gitscip-shell system . . git. commit -m "Nested submodule level 2"
788 gitscip-shell system . . git. push origin main
789
790 clone_repo "$submodname1" submod1
791 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
792 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
793
794 contents_sub1="We're dreaming?"
795 contents_sub1_oid=$(calc_oid "$contents_sub1")
796 printfscip-shell system . . printf. "%s" "$contents_sub1" > "sub1.dat"
797 # add submodule2 as submodule of submodule1
798 gitscip-shell system . . git. submodule add "$GITSERVER/$submodname2" sub2
799 gitscip-shell system . . git. submodule update
800 gitscip-shell system . . git. add sub2 sub1.dat .gitattributes
801 gitscip-shell system . . git. commit -m "Nested submodule level 1"
802 gitscip-shell system . . git. push origin main
803
804 clone_repo "$reponame" rootrepo
805 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
806 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
807
808 contents_root="Downwards is the only way forwards."
809 contents_root_oid=$(calc_oid "$contents_root")
810 printfscip-shell system . . printf. "%s" "$contents_root" > "root.dat"
811 # add submodule1 as submodule of root
812 gitscip-shell system . . git. submodule add "$GITSERVER/$submodname1" sub1
813 gitscip-shell system . . git. submodule update
814 gitscip-shell system . . git. add sub1 root.dat .gitattributes
815 gitscip-shell system . . git. commit -m "Root repo"
816 gitscip-shell system . . git. push origin main
817
818 pushd "$TRASHDIR"
819
820 local_reponame="submod-clone"
821 gitscip-shell system . . git. lfs clone --recursive "$GITSERVER/$reponame" "$local_reponame"
822
823 # check everything is where it should be
824 cd $local_reponame
825 assert_hooks "$(dot_git_dir)"
826 [scip-shell system . . `[`. ! -e "lfs" ]
827 assert_clean_status
828 # check LFS store and working copy
829 assert_local_object "$contents_root_oid" "${#contents_root}"
830 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "root.dat") -eq ${#contents_root} ]
831 # and so on for nested subs
832 cd sub1
833 assert_local_object "$contents_sub1_oid" "${#contents_sub1}"
834 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "sub1.dat") -eq ${#contents_sub1} ]
835 cd sub2
836 assert_local_object "$contents_sub2_oid" "${#contents_sub2}"
837 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "sub2.dat") -eq ${#contents_sub2} ]
838
839 popd
840 )
841 end_test
842
843 begin_test "clone in current directory"
844 (
845 set -e
846
847 reponame="clone_in_current_dir"
848 setup_remote_repo "$reponame"
849 clone_repo "$reponame" $reponame
850
851 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
852 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
853
854 contents="contents"
855 contents_oid="$(calc_oid "$contents")"
856
857 printfscip-shell system . . printf. "%s" "$contents" > a.dat
858
859 gitscip-shell system . . git. add .gitattributes a.dat
860
861 gitscip-shell system . . git. commit -m "initial commit" 2>&1 | teescip-shell system . . tee. commit.log
862 grepscip-shell system . . grep. "main (root-commit)" commit.log
863 grepscip-shell system . . grep. "2 files changed" commit.log
864 grepscip-shell system . . grep. "create mode 100644 a.dat" commit.log
865 grepscip-shell system . . grep. "create mode 100644 .gitattributes" commit.log
866
867 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
868
869 pushd $TRASHDIR
870 mkdirscip-shell system . . mkdir. "$reponame-clone"
871 cd "$reponame-clone"
872
873 gitscip-shell system . . git. lfs clone $GITSERVER/$reponame "."
874 gitscip-shell system . . git. lfs fsck
875
876 assert_local_object "$contents_oid" 8
877 assert_hooks "$(dot_git_dir)"
878 [scip-shell system . . `[`. ! -e "lfs" ]
879 assert_clean_status
880 popd
881 )
882 end_test
883
884 begin_test "clone empty repository"
885 (
886 set -e
887
888 reponame="clone_empty"
889 setup_remote_repo "$reponame"
890
891 cd "$TRASHDIR"
892 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$reponame" 2>&1 | teescip-shell system . . tee. clone.log
893 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
894 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
895 exit 1
896 fi
897 )
898 end_test
899
900 begin_test "clone bare empty repository"
901 (
902 set -e
903
904 reponame="clone_bare_empty"
905 setup_remote_repo "$reponame"
906
907 cd "$TRASHDIR"
908 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$reponame" --bare 2>&1 | teescip-shell system . . tee. clone.log
909 if [scip-shell system . . `[`. "0" -ne "${PIPESTATUS[0]}" ]; then
910 echoscip-shell system . . echo. >&2 "fatal: expected clone to succeed ..."
911 exit 1
912 fi
913 )
914 end_test
915
916 begin_test "clone (HTTP server/proxy require cookies)"
917 (
918 set -e
919
920 # golang net.http.Cookie ignores cookies with IP instead of domain/hostname
921 GITSERVER=$(echoscip-shell system . . echo. "$GITSERVER" | sedscip-shell system . . sed. 's/127\.0\.0\.1/localhost/')
922 cpscip-shell system . . cp. "$CREDSDIR/127.0.0.1" "$CREDSDIR/localhost"
923 printfscip-shell system . . printf. "localhost\tTRUE\t/\tFALSE\t2145916800\tCOOKIE_GITLFS\tsecret\n" >> "$REMOTEDIR/cookies.txt"
924 gitscip-shell system . . git. config --global http.cookieFile "$REMOTEDIR/cookies.txt"
925
926 reponame="require-cookie-test"
927 setup_remote_repo "$reponame"
928 clone_repo "$reponame" "$reponame"
929
930 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
931 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
932 gitscip-shell system . . git. add .gitattributes
933 gitscip-shell system . . git. commit -m "Track *.dat"
934
935 # generate some test data & commits with random LFS data
936 echoscip-shell system . . echo. "[
937 {
938 \"CommitDate\":\"$(get_date -10d)\",
939 \"Files\":[
940 {\"Filename\":\"file1.dat\",\"Size\":100},
941 {\"Filename\":\"file2.dat\",\"Size\":75}]
942 },
943 {
944 \"CommitDate\":\"$(get_date -7d)\",
945 \"Files\":[
946 {\"Filename\":\"file1.dat\",\"Size\":110},
947 {\"Filename\":\"file3.dat\",\"Size\":66},
948 {\"Filename\":\"file4.dat\",\"Size\":23}]
949 },
950 {
951 \"CommitDate\":\"$(get_date -10d)\",
952 \"Files\":[
953 {\"Filename\":\"file5.dat\",\"Size\":120},
954 {\"Filename\":\"file6.dat\",\"Size\":30}]
955 }
956 ]" | lfstest-testutils addcommits
957
958 gitscip-shell system . . git. push origin main
959
960 # Now clone again, test specific clone dir
961 cd "$TRASHDIR"
962
963 newclonedir="require-cookie-test1"
964 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" "$newclonedir" 2>&1 | teescip-shell system . . tee. lfsclone.log
965 grepscip-shell system . . grep. "Cloning into" lfsclone.log
966 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
967 # should be no filter errors
968 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
969 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
970 # should be cloned into location as per arg
971 [scip-shell system . . `[`. -d "$newclonedir" ]
972
973 # check a few file sizes to make sure pulled
974 pushd "$newclonedir"
975 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 110 ]
976 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
977 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 66 ]
978 assert_hooks "$(dot_git_dir)"
979 [scip-shell system . . `[`. ! -e "lfs" ]
980 assert_clean_status
981 popd
982
983 # Now check clone with implied dir
984 rmscip-shell system . . rm. -rf "$reponame"
985 gitscip-shell system . . git. lfs clone "$GITSERVER/$reponame" 2>&1 | teescip-shell system . . tee. lfsclone.log
986 grepscip-shell system . . grep. "Cloning into" lfsclone.log
987 grepscip-shell system . . grep. "Downloading LFS objects:" lfsclone.log
988 # should be no filter errors
989 grepscip-shell system . . grep. "filter" lfsclone.log && exit 1
990 grepscip-shell system . . grep. "error" lfsclone.log && exit 1
991 # clone location should be implied
992 [scip-shell system . . `[`. -d "$reponame" ]
993
994 pushd "$reponame"
995 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file1.dat") -eq 110 ]
996 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file2.dat") -eq 75 ]
997 [scip-shell system . . `[`. $(wcscip-shell system . . wc. -c < "file3.dat") -eq 66 ]
998 assert_hooks "$(dot_git_dir)"
999 [scip-shell system . . `[`. ! -e "lfs" ]
1000 assert_clean_status
1001 popd
1002 )
1003 end_test