@@ -12,144 +12,144 @@ test_expect_success setup '
1212
1313 git config core.autocrlf false &&
1414
15- for w in Hello world how are you; do echo $w; done >one &&
16- for w in I am very very fine thank you; do echo ${w}Q; done | q_to_cr >two &&
17- for w in Oh here is a QNUL byte how alarming; do echo ${w}; done | q_to_nul >three &&
15+ for w in Hello world how are you; do echo $w; done >LFonly &&
16+ for w in I am very very fine thank you; do echo ${w}Q; done | q_to_cr >CRLFonly &&
17+ for w in Oh here is a QNUL byte how alarming; do echo ${w}; done | q_to_nul >LFwithNUL &&
1818 git add . &&
1919
2020 git commit -m initial &&
2121
22- one =$(git rev-parse HEAD:one ) &&
23- two =$(git rev-parse HEAD:two ) &&
24- three =$(git rev-parse HEAD:three ) &&
22+ LFonly =$(git rev-parse HEAD:LFonly ) &&
23+ CRLFonly =$(git rev-parse HEAD:CRLFonly ) &&
24+ LFwithNUL =$(git rev-parse HEAD:LFwithNUL ) &&
2525
2626 echo happy.
2727'
2828
2929test_expect_success ' default settings cause no changes' '
3030
31- rm -f .gitattributes tmp one two three &&
31+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
3232 git read-tree --reset -u HEAD &&
3333
34- ! has_cr one &&
35- has_cr two &&
36- onediff =$(git diff one ) &&
37- twodiff =$(git diff two ) &&
38- threediff =$(git diff three ) &&
39- test -z "$onediff" && test -z "$twodiff" && test -z "$threediff "
34+ ! has_cr LFonly &&
35+ has_cr CRLFonly &&
36+ LFonlydiff =$(git diff LFonly ) &&
37+ CRLFonlydiff =$(git diff CRLFonly ) &&
38+ LFwithNULdiff =$(git diff LFwithNUL ) &&
39+ test -z "$LFonlydiff" -a -z "$CRLFonlydiff" -a -z "$LFwithNULdiff "
4040'
4141
4242test_expect_success ' crlf=true causes a CRLF file to be normalized' '
4343
4444 # Backwards compatibility check
45- rm -f .gitattributes tmp one two three &&
46- echo "two crlf" > .gitattributes &&
45+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
46+ echo "CRLFonly crlf" > .gitattributes &&
4747 git read-tree --reset -u HEAD &&
4848
4949 # Note, "normalized" means that git will normalize it if added
50- has_cr two &&
51- twodiff =$(git diff two ) &&
52- test -n "$twodiff "
50+ has_cr CRLFonly &&
51+ CRLFonlydiff =$(git diff CRLFonly ) &&
52+ test -n "$CRLFonlydiff "
5353'
5454
5555test_expect_success ' text=true causes a CRLF file to be normalized' '
5656
57- rm -f .gitattributes tmp one two three &&
58- echo "two text" > .gitattributes &&
57+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
58+ echo "CRLFonly text" > .gitattributes &&
5959 git read-tree --reset -u HEAD &&
6060
6161 # Note, "normalized" means that git will normalize it if added
62- has_cr two &&
63- twodiff =$(git diff two ) &&
64- test -n "$twodiff "
62+ has_cr CRLFonly &&
63+ CRLFonlydiff =$(git diff CRLFonly ) &&
64+ test -n "$CRLFonlydiff "
6565'
6666
6767test_expect_success ' eol=crlf gives a normalized file CRLFs with autocrlf=false' '
6868
69- rm -f .gitattributes tmp one two three &&
69+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
7070 git config core.autocrlf false &&
71- echo "one eol=crlf" > .gitattributes &&
71+ echo "LFonly eol=crlf" > .gitattributes &&
7272 git read-tree --reset -u HEAD &&
7373
74- has_cr one &&
75- onediff =$(git diff one ) &&
76- test -z "$onediff "
74+ has_cr LFonly &&
75+ LFonlydiff =$(git diff LFonly ) &&
76+ test -z "$LFonlydiff "
7777'
7878
7979test_expect_success ' eol=crlf gives a normalized file CRLFs with autocrlf=input' '
8080
81- rm -f .gitattributes tmp one two three &&
81+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
8282 git config core.autocrlf input &&
83- echo "one eol=crlf" > .gitattributes &&
83+ echo "LFonly eol=crlf" > .gitattributes &&
8484 git read-tree --reset -u HEAD &&
8585
86- has_cr one &&
87- onediff =$(git diff one ) &&
88- test -z "$onediff "
86+ has_cr LFonly &&
87+ LFonlydiff =$(git diff LFonly ) &&
88+ test -z "$LFonlydiff "
8989'
9090
9191test_expect_success ' eol=lf gives a normalized file LFs with autocrlf=true' '
9292
93- rm -f .gitattributes tmp one two three &&
93+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
9494 git config core.autocrlf true &&
95- echo "one eol=lf" > .gitattributes &&
95+ echo "LFonly eol=lf" > .gitattributes &&
9696 git read-tree --reset -u HEAD &&
9797
98- ! has_cr one &&
99- onediff =$(git diff one ) &&
100- test -z "$onediff "
98+ ! has_cr LFonly &&
99+ LFonlydiff =$(git diff LFonly ) &&
100+ test -z "$LFonlydiff "
101101'
102102
103103test_expect_success ' autocrlf=true does not normalize CRLF files' '
104104
105- rm -f .gitattributes tmp one two three &&
105+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
106106 git config core.autocrlf true &&
107107 git read-tree --reset -u HEAD &&
108108
109- has_cr one &&
110- has_cr two &&
111- onediff =$(git diff one ) &&
112- twodiff =$(git diff two ) &&
113- threediff =$(git diff three ) &&
114- test -z "$onediff" && test -z "$twodiff" && test -z "$threediff "
109+ has_cr LFonly &&
110+ has_cr CRLFonly &&
111+ LFonlydiff =$(git diff LFonly ) &&
112+ CRLFonlydiff =$(git diff CRLFonly ) &&
113+ LFwithNULdiff =$(git diff LFwithNUL ) &&
114+ test -z "$LFonlydiff" -a -z "$CRLFonlydiff" -a -z "$LFwithNULdiff "
115115'
116116
117117test_expect_success ' text=auto, autocrlf=true _does_ normalize CRLF files' '
118118
119- rm -f .gitattributes tmp one two three &&
119+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
120120 git config core.autocrlf true &&
121121 echo "* text=auto" > .gitattributes &&
122122 git read-tree --reset -u HEAD &&
123123
124- has_cr one &&
125- has_cr two &&
126- onediff =$(git diff one ) &&
127- twodiff =$(git diff two ) &&
128- threediff =$(git diff three ) &&
129- test -z "$onediff" && test -n "$twodiff" && test -z "$threediff "
124+ has_cr LFonly &&
125+ has_cr CRLFonly &&
126+ LFonlydiff =$(git diff LFonly ) &&
127+ CRLFonlydiff =$(git diff CRLFonly ) &&
128+ LFwithNULdiff =$(git diff LFwithNUL ) &&
129+ test -z "$LFonlydiff" -a -n "$CRLFonlydiff" -a -z "$LFwithNULdiff "
130130'
131131
132132test_expect_success ' text=auto, autocrlf=true does not normalize binary files' '
133133
134- rm -f .gitattributes tmp one two three &&
134+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
135135 git config core.autocrlf true &&
136136 echo "* text=auto" > .gitattributes &&
137137 git read-tree --reset -u HEAD &&
138138
139- ! has_cr three &&
140- threediff =$(git diff three ) &&
141- test -z "$threediff "
139+ ! has_cr LFwithNUL &&
140+ LFwithNULdiff =$(git diff LFwithNUL ) &&
141+ test -z "$LFwithNULdiff "
142142'
143143
144144test_expect_success ' eol=crlf _does_ normalize binary files' '
145145
146- rm -f .gitattributes tmp one two three &&
147- echo "three eol=crlf" > .gitattributes &&
146+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
147+ echo "LFwithNUL eol=crlf" > .gitattributes &&
148148 git read-tree --reset -u HEAD &&
149149
150- has_cr three &&
151- threediff =$(git diff three ) &&
152- test -z "$threediff "
150+ has_cr LFwithNUL &&
151+ LFwithNULdiff =$(git diff LFwithNUL ) &&
152+ test -z "$LFwithNULdiff "
153153'
154154
155155test_done
0 commit comments