3 . "$(dirname "$0")/testlib.sh"
5 begin_test "content-type: is enabled by default"
9 reponame="content-type-enabled-default"
10 setup_remote_repo "$reponame"
11 clone_repo "$reponame" "$reponame"
13 git lfs track "*.tar.gz"
14 printf "aaaaaaaaaa" > a.txt
15 tar -czf a.tar.gz a.txt
18 git add .gitattributes a.tar.gz
19 git commit -m "initial commit"
20 GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
22 [ 1 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
26 begin_test "content-type: is disabled by configuration"
30 reponame="content-type-disabled-by-configuration"
31 setup_remote_repo "$reponame"
32 clone_repo "$reponame" "$reponame"
34 git lfs track "*.tar.gz"
35 printf "aaaaaaaaaa" > a.txt
36 tar -czf a.tar.gz a.txt
39 git add .gitattributes a.tar.gz
40 git commit -m "initial commit"
41 git config "lfs.$GITSERVER.contenttype" 0
42 GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
44 [ 0 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
48 begin_test "content-type: warning message"
52 reponame="content-type-warning-message"
53 setup_remote_repo "$reponame"
54 clone_repo "$reponame" "$reponame"
57 printf "status-storage-422" > a.txt
59 git add .gitattributes a.txt
60 git commit -m "initial commit"
61 git push origin master 2>&1 | tee push.log
63 grep "info: Uploading failed due to unsupported Content-Type header(s)." push.log
64 grep "info: Consider disabling Content-Type detection with:" push.log
65 grep "info: $ git config lfs.contenttype false" push.log