Skip to content

Commit

Permalink
t: use 'tar' instead of 'zip'
Browse files Browse the repository at this point in the history
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:

    []byte{0x50, 0x4B, 0x03, 0x04}

And thus are detected as 'application/zip' by http.DetectContentType().

However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).

Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:

    []byte{0x1F, 0x8B, 0x80}

Thus are detected as 'application/x-gzip' by http.DetectContentType().

This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.

[1]: 938df5c (tq/basic_upload.go: disable Content-Type detection by
     configuration, 2018-07-31)
  • Loading branch information
ttaylorr committed Aug 1, 2018
1 parent 1818c59 commit 0a46cbf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions t/t-content-type.sh
Expand Up @@ -10,16 +10,16 @@ begin_test "content-type: is enabled by default"
setup_remote_repo "$reponame"
clone_repo "$reponame" "$reponame"

git lfs track "*.zip"
git lfs track "*.tar.gz"
printf "aaaaaaaaaa" > a.txt
zip -j a.zip a.txt
tar -czf a.tar.gz a.txt
rm a.txt

git add .gitattributes a.zip
git add .gitattributes a.tar.gz
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)" ]
[ 1 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
)
end_test

Expand All @@ -31,17 +31,17 @@ begin_test "content-type: is disabled by configuration"
setup_remote_repo "$reponame"
clone_repo "$reponame" "$reponame"

git lfs track "*.zip"
git lfs track "*.tar.gz"
printf "aaaaaaaaaa" > a.txt
zip -j a.zip a.txt
tar -czf a.tar.gz a.txt
rm a.txt

git add .gitattributes a.zip
git add .gitattributes a.tar.gz
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)" ]
[ 0 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
)
end_test

Expand Down

0 comments on commit 0a46cbf

Please sign in to comment.