Skip to content

Commit f1265cc

Browse files
hashplinggitster
authored andcommitted
Add new test to demonstrate git archive core.autocrlf inconsistency
Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 53c3967 commit f1265cc

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

t/t0024-crlf-archive.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
3+
test_description='respect crlf in git archive'
4+
5+
. ./test-lib.sh
6+
UNZIP=${UNZIP:-unzip}
7+
8+
test_expect_success setup '
9+
10+
git config core.autocrlf true
11+
12+
printf "CRLF line ending\r\nAnd another\r\n" > sample &&
13+
git add sample &&
14+
15+
test_tick &&
16+
git commit -m Initial
17+
18+
'
19+
20+
test_expect_success 'tar archive' '
21+
22+
git archive --format=tar HEAD |
23+
( mkdir untarred && cd untarred && "$TAR" -xf - )
24+
25+
test_cmp sample untarred/sample
26+
27+
'
28+
29+
"$UNZIP" -v >/dev/null 2>&1
30+
if [ $? -eq 127 ]; then
31+
echo "Skipping ZIP test, because unzip was not found"
32+
test_done
33+
exit
34+
fi
35+
36+
test_expect_failure 'zip archive' '
37+
38+
git archive --format=zip HEAD >test.zip &&
39+
40+
( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
41+
42+
test_cmp sample unzipped/sample
43+
44+
'
45+
46+
test_done

0 commit comments

Comments
 (0)