@@ -12,144 +12,144 @@ test_expect_success setup '
12
12
13
13
git config core.autocrlf false &&
14
14
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 &&
18
18
git add . &&
19
19
20
20
git commit -m initial &&
21
21
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 ) &&
25
25
26
26
echo happy.
27
27
'
28
28
29
29
test_expect_success ' default settings cause no changes' '
30
30
31
- rm -f .gitattributes tmp one two three &&
31
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
32
32
git read-tree --reset -u HEAD &&
33
33
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 "
40
40
'
41
41
42
42
test_expect_success ' crlf=true causes a CRLF file to be normalized' '
43
43
44
44
# 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 &&
47
47
git read-tree --reset -u HEAD &&
48
48
49
49
# 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 "
53
53
'
54
54
55
55
test_expect_success ' text=true causes a CRLF file to be normalized' '
56
56
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 &&
59
59
git read-tree --reset -u HEAD &&
60
60
61
61
# 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 "
65
65
'
66
66
67
67
test_expect_success ' eol=crlf gives a normalized file CRLFs with autocrlf=false' '
68
68
69
- rm -f .gitattributes tmp one two three &&
69
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
70
70
git config core.autocrlf false &&
71
- echo "one eol=crlf" > .gitattributes &&
71
+ echo "LFonly eol=crlf" > .gitattributes &&
72
72
git read-tree --reset -u HEAD &&
73
73
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 "
77
77
'
78
78
79
79
test_expect_success ' eol=crlf gives a normalized file CRLFs with autocrlf=input' '
80
80
81
- rm -f .gitattributes tmp one two three &&
81
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
82
82
git config core.autocrlf input &&
83
- echo "one eol=crlf" > .gitattributes &&
83
+ echo "LFonly eol=crlf" > .gitattributes &&
84
84
git read-tree --reset -u HEAD &&
85
85
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 "
89
89
'
90
90
91
91
test_expect_success ' eol=lf gives a normalized file LFs with autocrlf=true' '
92
92
93
- rm -f .gitattributes tmp one two three &&
93
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
94
94
git config core.autocrlf true &&
95
- echo "one eol=lf" > .gitattributes &&
95
+ echo "LFonly eol=lf" > .gitattributes &&
96
96
git read-tree --reset -u HEAD &&
97
97
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 "
101
101
'
102
102
103
103
test_expect_success ' autocrlf=true does not normalize CRLF files' '
104
104
105
- rm -f .gitattributes tmp one two three &&
105
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
106
106
git config core.autocrlf true &&
107
107
git read-tree --reset -u HEAD &&
108
108
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 "
115
115
'
116
116
117
117
test_expect_success ' text=auto, autocrlf=true _does_ normalize CRLF files' '
118
118
119
- rm -f .gitattributes tmp one two three &&
119
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
120
120
git config core.autocrlf true &&
121
121
echo "* text=auto" > .gitattributes &&
122
122
git read-tree --reset -u HEAD &&
123
123
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 "
130
130
'
131
131
132
132
test_expect_success ' text=auto, autocrlf=true does not normalize binary files' '
133
133
134
- rm -f .gitattributes tmp one two three &&
134
+ rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
135
135
git config core.autocrlf true &&
136
136
echo "* text=auto" > .gitattributes &&
137
137
git read-tree --reset -u HEAD &&
138
138
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 "
142
142
'
143
143
144
144
test_expect_success ' eol=crlf _does_ normalize binary files' '
145
145
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 &&
148
148
git read-tree --reset -u HEAD &&
149
149
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 "
153
153
'
154
154
155
155
test_done
0 commit comments