@@ -71,12 +71,21 @@ commit_check_warn () {
71
71
attr=$2
72
72
lfname=$3
73
73
crlfname=$4
74
- lfmixcrlf =$5
75
- lfmixcr =$6
76
- crlfnul =$7
77
- create_gitattributes " $attr " &&
74
+ repoMIX =$5
75
+ lfmixcrlf =$6
76
+ lfmixcr =$7
77
+ crlfnul= $8
78
78
pfx=crlf_${crlf} _attr_${attr}
79
- for f in LF CRLF LF_mix_CR CRLF_mix_LF CRLF_nul
79
+ # Special handling for repoMIX: It should already be in the repo
80
+ # with CRLF
81
+ f=repoMIX
82
+ fname=${pfx} _$f .txt
83
+ echo > .gitattributes &&
84
+ cp $f $fname &&
85
+ git -c core.autocrlf=false add $fname 2> " ${pfx} _$f .err" &&
86
+ git commit -m " repoMIX" &&
87
+ create_gitattributes " $attr " &&
88
+ for f in LF CRLF repoMIX LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul
80
89
do
81
90
fname=${pfx} _$f .txt &&
82
91
cp $f $fname &&
@@ -120,7 +129,7 @@ checkout_files () {
120
129
git config core.autocrlf $crlf &&
121
130
pfx=eol_${eol} _crlf_${crlf} _attr_${attr} _ &&
122
131
src=crlf_false_attr__ &&
123
- for f in LF CRLF LF_mix_CR CRLF_mix_LF CRLF_nul
132
+ for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul
124
133
do
125
134
rm $src$f .txt &&
126
135
if test -z " $eol " ; then
@@ -142,8 +151,8 @@ checkout_files () {
142
151
test_expect_success " checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF_mix_CR" "
143
152
compare_ws_file $pfx $lfmixcr ${src} LF_mix_CR.txt
144
153
"
145
- test_expect_success " checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=CRLF_nul " "
146
- compare_ws_file $pfx $crlfnul ${src} CRLF_nul .txt
154
+ test_expect_success " checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF_nul " "
155
+ compare_ws_file $pfx $crlfnul ${src} LF_nul .txt
147
156
"
148
157
}
149
158
@@ -155,6 +164,7 @@ test_expect_success 'setup master' '
155
164
git commit -m "add .gitattributes" "" &&
156
165
printf "line1\nline2\nline3" >LF &&
157
166
printf "line1\r\nline2\r\nline3" >CRLF &&
167
+ printf "line1\r\nline2\nline3" >repoMIX &&
158
168
printf "line1\r\nline2\nline3" >CRLF_mix_LF &&
159
169
printf "line1\nline2\rline3" >LF_mix_CR &&
160
170
printf "line1\r\nline2\rline3" >CRLF_mix_CR &&
@@ -181,40 +191,41 @@ else
181
191
WAMIX=CRLF_LF
182
192
fi
183
193
194
+ # attr LF CRLF repoMIX CRLFmixLF LFmixCR CRLFNUL
184
195
test_expect_success ' commit files empty attr' '
185
- commit_check_warn false "" "" "" "" "" "" &&
186
- commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
187
- commit_check_warn input "" "" "CRLF_LF" "CRLF_LF" "" ""
196
+ commit_check_warn false "" "" "" "" "" "" "" &&
197
+ commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" " " "" &&
198
+ commit_check_warn input "" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" " " ""
188
199
'
189
200
190
201
test_expect_success ' commit files attr=auto' '
191
- commit_check_warn false "auto" "$WILC" "$WICL" "$WAMIX" "" "" &&
192
- commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
193
- commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
202
+ commit_check_warn false "auto" "$WILC" "$WICL" "$WAMIX" "$WAMIX" "" "" &&
203
+ commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" " " "" &&
204
+ commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" " " ""
194
205
'
195
206
196
207
test_expect_success ' commit files attr=text' '
197
- commit_check_warn false "text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL" &&
198
- commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
199
- commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
208
+ commit_check_warn false "text" "$WILC" "$WICL" "$WAMIX" "$WAMIX" "$WILC" "$WICL" &&
209
+ commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "LF_CRLF" " " &&
210
+ commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" " " "CRLF_LF"
200
211
'
201
212
202
213
test_expect_success ' commit files attr=-text' '
203
- commit_check_warn false "-text" "" "" "" "" "" &&
204
- commit_check_warn true "-text" "" "" "" "" "" &&
205
- commit_check_warn input "-text" "" "" "" "" ""
214
+ commit_check_warn false "-text" "" "" "" "" "" "" &&
215
+ commit_check_warn true "-text" "" "" "" "" "" "" &&
216
+ commit_check_warn input "-text" "" "" "" "" "" ""
206
217
'
207
218
208
219
test_expect_success ' commit files attr=lf' '
209
- commit_check_warn false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
210
- commit_check_warn true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
211
- commit_check_warn input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
220
+ commit_check_warn false "lf" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
221
+ commit_check_warn true "lf" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
222
+ commit_check_warn input "lf" "" "CRLF_LF" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
212
223
'
213
224
214
225
test_expect_success ' commit files attr=crlf' '
215
- commit_check_warn false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
216
- commit_check_warn true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
217
- commit_check_warn input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
226
+ commit_check_warn false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "LF_CRLF" " " &&
227
+ commit_check_warn true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "LF_CRLF" " " &&
228
+ commit_check_warn input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "LF_CRLF" " "
218
229
'
219
230
220
231
test_expect_success ' create files cleanup' '
@@ -268,79 +279,81 @@ test_expect_success 'commit -text' '
268
279
# eol acrlf
269
280
# ----------------------------------------------
270
281
# What we want to have in the working tree:
271
- if test_have_prereq MINGW
282
+ if test_have_prereq NATIVE_CRLF
272
283
then
273
284
MIX_CRLF_LF=CRLF
274
285
MIX_LF_CR=CRLF_mix_CR
275
286
NL=CRLF
287
+ LFNUL=CRLF_nul
276
288
else
277
289
MIX_CRLF_LF=CRLF_mix_LF
278
290
MIX_LF_CR=LF_mix_CR
279
291
NL=LF
292
+ LFNUL=LF_nul
280
293
fi
281
294
export CRLF_MIX_LF_CR MIX NL
282
295
283
- checkout_files lf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
284
- checkout_files lf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
285
- checkout_files lf input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
286
- checkout_files lf false " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
287
- checkout_files lf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
288
- checkout_files lf input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
289
- checkout_files lf false " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
296
+ checkout_files lf false " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
297
+ checkout_files lf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
298
+ checkout_files lf input " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
299
+ checkout_files lf false " auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
300
+ checkout_files lf true " auto" CRLF CRLF CRLF LF_mix_CR LF_nul
301
+ checkout_files lf input " auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
302
+ checkout_files lf false " text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
290
303
checkout_files lf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
291
- checkout_files lf input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
292
- checkout_files lf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
293
- checkout_files lf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
294
- checkout_files lf input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
295
- checkout_files lf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
296
- checkout_files lf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
297
- checkout_files lf input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
304
+ checkout_files lf input " text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
305
+ checkout_files lf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
306
+ checkout_files lf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
307
+ checkout_files lf input " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
308
+ checkout_files lf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
309
+ checkout_files lf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
310
+ checkout_files lf input " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
298
311
checkout_files lf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
299
312
checkout_files lf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
300
313
checkout_files lf input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
301
314
302
- checkout_files crlf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
303
- checkout_files crlf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
304
- checkout_files crlf false " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
305
- checkout_files crlf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
315
+ checkout_files crlf false " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
316
+ checkout_files crlf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
317
+ checkout_files crlf false " auto" CRLF CRLF CRLF LF_mix_CR LF_nul
318
+ checkout_files crlf true " auto" CRLF CRLF CRLF LF_mix_CR LF_nul
306
319
checkout_files crlf false " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
307
320
checkout_files crlf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
308
- checkout_files crlf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
309
- checkout_files crlf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
310
- checkout_files crlf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
311
- checkout_files crlf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
321
+ checkout_files crlf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
322
+ checkout_files crlf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
323
+ checkout_files crlf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
324
+ checkout_files crlf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
312
325
checkout_files crlf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
313
326
checkout_files crlf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
314
327
315
- checkout_files " " false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
316
- checkout_files " " true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
317
- checkout_files " " input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
318
- checkout_files " " false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
319
- checkout_files " " true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
320
- checkout_files " " input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
321
- checkout_files " " false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
328
+ checkout_files " " false " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
329
+ checkout_files " " true " " CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
330
+ checkout_files " " input " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
331
+ checkout_files " " false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR LF_nul
332
+ checkout_files " " true " auto" CRLF CRLF CRLF LF_mix_CR LF_nul
333
+ checkout_files " " input " auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
334
+ checkout_files " " false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR $LFNUL
322
335
checkout_files " " true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
323
- checkout_files " " input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
324
- checkout_files " " false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
325
- checkout_files " " true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
326
- checkout_files " " input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
327
- checkout_files " " false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
328
- checkout_files " " true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
329
- checkout_files " " input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
336
+ checkout_files " " input " text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
337
+ checkout_files " " false " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
338
+ checkout_files " " true " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
339
+ checkout_files " " input " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
340
+ checkout_files " " false " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
341
+ checkout_files " " true " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
342
+ checkout_files " " input " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
330
343
checkout_files " " false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
331
344
checkout_files " " true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
332
345
checkout_files " " input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
333
346
334
- checkout_files native false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
335
- checkout_files native true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
336
- checkout_files native false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
337
- checkout_files native true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
338
- checkout_files native false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
347
+ checkout_files native false " " LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
348
+ checkout_files native true " " CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
349
+ checkout_files native false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR LF_nul
350
+ checkout_files native true " auto" CRLF CRLF CRLF LF_mix_CR LF_nul
351
+ checkout_files native false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR $LFNUL
339
352
checkout_files native true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
340
- checkout_files native false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
341
- checkout_files native true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
342
- checkout_files native false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
343
- checkout_files native true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
353
+ checkout_files native false " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
354
+ checkout_files native true " -text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
355
+ checkout_files native false " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
356
+ checkout_files native true " lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
344
357
checkout_files native false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
345
358
checkout_files native true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
346
359
0 commit comments