Debian Codegraph @

t/t-content-type.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 "content-type: is enabled by default"
6 (
7 set -e
8
9 reponame="content-type-enabled-default"
10 setup_remote_repo "$reponame"
11 clone_repo "$reponame" "$reponame"
12
13 gitscip-shell system . . git. lfs track "*.tar.gz"
14 printfscip-shell system . . printf. "aaaaaaaaaa" > a.txt
15 tarscip-shell system . . tar. -czf a.tar.gz a.txt
16 rmscip-shell system . . rm. a.txt
17
18 gitscip-shell system . . git. add .gitattributes a.tar.gz
19 gitscip-shell system . . git. commit -m "initial commit"
20 GIT_CURL_VERBOSE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
21
22 [scip-shell system . . `[`. 1 -eq "$(grepscip-shell system . . grep. -c "Content-Type: application/x-gzip" push.log)" ]
23 [scip-shell system . . `[`. 0 -eq "$(grepscip-shell system . . grep. -c "Content-Type: application/octet-stream" push.log)" ]
24 )
25 end_test
26
27 begin_test "content-type: is disabled by configuration"
28 (
29 set -e
30
31 reponame="content-type-disabled-by-configuration"
32 setup_remote_repo "$reponame"
33 clone_repo "$reponame" "$reponame"
34
35 gitscip-shell system . . git. lfs track "*.tar.gz"
36 printfscip-shell system . . printf. "aaaaaaaaaa" > a.txt
37 tarscip-shell system . . tar. -czf a.tar.gz a.txt
38 rmscip-shell system . . rm. a.txt
39
40 gitscip-shell system . . git. add .gitattributes a.tar.gz
41 gitscip-shell system . . git. commit -m "initial commit"
42 gitscip-shell system . . git. config "lfs.$GITSERVER.contenttype" 0
43 GIT_CURL_VERBOSE=1 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
44
45 [scip-shell system . . `[`. 0 -eq "$(grepscip-shell system . . grep. -c "Content-Type: application/x-gzip" push.log)" ]
46 [scip-shell system . . `[`. 1 -eq "$(grepscip-shell system . . grep. -c "Content-Type: application/octet-stream" push.log)" ]
47 )
48 end_test
49
50 begin_test "content-type: warning message"
51 (
52 set -e
53
54 reponame="content-type-warning-message"
55 setup_remote_repo "$reponame"
56 clone_repo "$reponame" "$reponame"
57
58 gitscip-shell system . . git. lfs track "*.txt"
59 printfscip-shell system . . printf. "status-storage-422" > a.txt
60
61 gitscip-shell system . . git. add .gitattributes a.txt
62 gitscip-shell system . . git. commit -m "initial commit"
63 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
64
65 grepscip-shell system . . grep. "info: Uploading failed due to unsupported Content-Type header(s)." push.log
66 grepscip-shell system . . grep. "info: Consider disabling Content-Type detection with:" push.log
67 grepscip-shell system . . grep. "info: $ git config lfs.contenttype false" push.log
68 )
69 end_test