git-lfs/t/t-content-type.sh
Taylor Blau 55ce439375 t: fix 'git config' invocation in content type tests
In the commit introducing this code ([1]), I wrote a typo such that the
'git config' invocation changed did not apply 'contenttype=0' to the API
call executed by 'git push origin master'.

So, when I copied and pasted this test case from the one above, I didn't
change the '1' to a '0', because when I ran 'make -B t-content-type.sh',
the test passed.

This commit fixes the incorrect spelling in 'git config' and updates the
assertion to pass, and confirms that setting a 'contenttype' to '0'
disables content-type detection.

[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
     configuration, 2018-07-31)
2018-07-31 19:47:10 -05:00

68 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
. "$(dirname "$0")/testlib.sh"
begin_test "content-type: is enabled by default"
(
set -e
reponame="content-type-enabled-default"
setup_remote_repo "$reponame"
clone_repo "$reponame" "$reponame"
git lfs track "*.zip"
printf "aaaaaaaaaa" > a.txt
zip -j a.zip a.txt
rm a.txt
git add .gitattributes a.zip
git commit -m "initial commit"
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
[ 1 -eq "$(grep -c "Content-Type: application/zip" push.log)" ]
)
end_test
begin_test "content-type: is disabled by configuration"
(
set -e
reponame="content-type-disabled-by-configuration"
setup_remote_repo "$reponame"
clone_repo "$reponame" "$reponame"
git lfs track "*.zip"
printf "aaaaaaaaaa" > a.txt
zip -j a.zip a.txt
rm a.txt
git add .gitattributes a.zip
git commit -m "initial commit"
git config "lfs.$GITSERVER.contenttype" 0
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
[ 0 -eq "$(grep -c "Content-Type: application/zip" push.log)" ]
)
end_test
begin_test "content-type: warning message"
(
set -e
reponame="content-type-warning-message"
setup_remote_repo "$reponame"
clone_repo "$reponame" "$reponame"
git lfs track "*.txt"
printf "status-storage-422" > a.txt
git add .gitattributes a.txt
git commit -m "initial commit"
git push origin master 2>&1 | tee push.log
grep "info: Uploading failed due to unsupported Content-Type header(s)." push.log
grep "info: Consider disabling Content-Type detection with:" push.log
grep "info: $ git config lfs.contenttype false" push.log
)
end_test