5378787e1b23bf18796c28c33533f677b389289c
[platform/upstream/git.git] / t / t0024-crlf-archive.sh
1 #!/bin/sh
2
3 test_description='respect crlf in git archive'
4
5 . ./test-lib.sh
6 GIT_UNZIP=${GIT_UNZIP:-unzip}
7
8 test_lazy_prereq UNZIP '
9         "$GIT_UNZIP" -v
10         test $? -ne 127
11 '
12
13 test_expect_success setup '
14
15         git config core.autocrlf true &&
16
17         printf "CRLF line ending\r\nAnd another\r\n" > sample &&
18         git add sample &&
19
20         test_tick &&
21         git commit -m Initial
22
23 '
24
25 test_expect_success 'tar archive' '
26
27         git archive --format=tar HEAD |
28         ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
29
30         test_cmp sample untarred/sample
31
32 '
33
34 test_expect_success UNZIP 'zip archive' '
35
36         git archive --format=zip HEAD >test.zip &&
37
38         ( mkdir unzipped && cd unzipped && "$GIT_UNZIP" ../test.zip ) &&
39
40         test_cmp sample unzipped/sample
41
42 '
43
44 test_done