2008-09-19 00:01:13 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='respect crlf in git archive'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
2013-01-06 21:47:57 +04:00
|
|
|
GIT_UNZIP=${GIT_UNZIP:-unzip}
|
2008-09-19 00:01:13 +04:00
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
|
2010-10-31 04:46:54 +03:00
|
|
|
git config core.autocrlf true &&
|
2008-09-19 00:01:13 +04:00
|
|
|
|
|
|
|
printf "CRLF line ending\r\nAnd another\r\n" > sample &&
|
|
|
|
git add sample &&
|
|
|
|
|
|
|
|
test_tick &&
|
|
|
|
git commit -m Initial
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'tar archive' '
|
|
|
|
|
|
|
|
git archive --format=tar HEAD |
|
2010-10-31 04:46:54 +03:00
|
|
|
( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
|
2008-09-19 00:01:13 +04:00
|
|
|
|
|
|
|
test_cmp sample untarred/sample
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-01-06 21:47:57 +04:00
|
|
|
"$GIT_UNZIP" -v >/dev/null 2>&1
|
2008-09-19 00:01:13 +04:00
|
|
|
if [ $? -eq 127 ]; then
|
2009-03-01 21:52:51 +03:00
|
|
|
say "Skipping ZIP test, because unzip was not found"
|
2009-03-16 16:44:56 +03:00
|
|
|
else
|
|
|
|
test_set_prereq UNZIP
|
2008-09-19 00:01:13 +04:00
|
|
|
fi
|
|
|
|
|
2009-03-16 16:44:56 +03:00
|
|
|
test_expect_success UNZIP 'zip archive' '
|
2008-09-19 00:01:13 +04:00
|
|
|
|
|
|
|
git archive --format=zip HEAD >test.zip &&
|
|
|
|
|
2013-01-06 21:47:57 +04:00
|
|
|
( mkdir unzipped && cd unzipped && "$GIT_UNZIP" ../test.zip ) &&
|
2008-09-19 00:01:13 +04:00
|
|
|
|
|
|
|
test_cmp sample unzipped/sample
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|