]>
Commit | Line | Data |
---|---|---|
9472935d TB |
1 | #!/bin/sh |
2 | ||
3 | test_description='CRLF renormalization' | |
4 | ||
c150064d | 5 | TEST_PASSES_SANITIZE_LEAK=true |
9472935d TB |
6 | . ./test-lib.sh |
7 | ||
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 | |
15 | ' | |
16 | ||
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 | |
9b6d1fc4 SM |
25 | git ls-files --eol >tmp && |
26 | sed -e "s/ / /g" -e "s/ */ /g" tmp | | |
9472935d TB |
27 | sort >actual && |
28 | test_cmp expect actual | |
29 | ' | |
30 | ||
9e5da3d0 JK |
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 | |
38 | ' | |
39 | ||
9472935d | 40 | test_done |