The twelfth batch
[git/gitster.git] / t / t0025-crlf-renormalize.sh
blobf7202c192e7b63e07c904fe9dcf1b76252d8808d
1 #!/bin/sh
3 test_description='CRLF renormalization'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 git config core.autocrlf false &&
10 printf "LINEONE\nLINETWO\nLINETHREE\n" >LF.txt &&
11 printf "LINEONE\r\nLINETWO\r\nLINETHREE\r\n" >CRLF.txt &&
12 printf "LINEONE\r\nLINETWO\nLINETHREE\n" >CRLF_mix_LF.txt &&
13 git add . &&
14 git commit -m initial
17 test_expect_success 'renormalize CRLF in repo' '
18 echo "*.txt text=auto" >.gitattributes &&
19 git add --renormalize "*.txt" &&
20 cat >expect <<-\EOF &&
21 i/lf w/crlf attr/text=auto CRLF.txt
22 i/lf w/lf attr/text=auto LF.txt
23 i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
24 EOF
25 git ls-files --eol >tmp &&
26 sed -e "s/ / /g" -e "s/ */ /g" tmp |
27 sort >actual &&
28 test_cmp expect actual
31 test_expect_success 'ignore-errors not mistaken for renormalize' '
32 git reset --hard &&
33 echo "*.txt text=auto" >.gitattributes &&
34 git ls-files --eol >expect &&
35 git add --ignore-errors "*.txt" &&
36 git ls-files --eol >actual &&
37 test_cmp expect actual
40 test_done