3 test_description='CRLF conversion all combinations'
7 if ! test_have_prereq EXPENSIVE
9 skip_all="EXPENSIVE not set"
14 tr '\015\000' QN <"$1" >"$1".expect &&
15 tr '\015\000' QN <"$2" >"$2".actual &&
16 test_cmp "$1".expect "$2".actual &&
17 rm "$1".expect "$2".actual
24 tr '\015\000' QN <"$2" >"$exp" &&
25 tr '\015\000' QN <"$3" >"$act" &&
30 create_gitattributes () {
34 echo "*.txt text=auto" >.gitattributes
37 echo "*.txt text" >.gitattributes
40 echo "*.txt -text" >.gitattributes
43 echo "*.txt eol=crlf" >.gitattributes
46 echo "*.txt eol=lf" >.gitattributes
52 echo >&2 invalid attribute: $attr
59 for crlf in false true input
61 for attr in "" auto text -text lf crlf
63 pfx=NNO_${crlf}_attr_${attr} &&
64 cp CRLF_mix_LF ${pfx}_LF.txt &&
65 cp CRLF_mix_LF ${pfx}_CRLF.txt &&
66 cp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&
67 cp CRLF_mix_LF ${pfx}_LF_mix_CR.txt &&
68 cp CRLF_mix_LF ${pfx}_CRLF_nul.txt
75 LF_CRLF) echo "warning: LF will be replaced by CRLF" >"$2".expect ;;
76 CRLF_LF) echo "warning: CRLF will be replaced by LF" >"$2".expect ;;
78 *) echo >&2 "Illegal 1": "$1" ; return false ;;
80 grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq >"$2".actual
81 test_cmp "$2".expect "$2".actual
84 commit_check_warn () {
92 pfx=crlf_${crlf}_attr_${attr}
93 create_gitattributes "$attr" &&
94 for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul
96 fname=${pfx}_$f.txt &&
98 git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
100 git commit -m "core.autocrlf $crlf" &&
101 check_warning "$lfname" ${pfx}_LF.err &&
102 check_warning "$crlfname" ${pfx}_CRLF.err &&
103 check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err &&
104 check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err &&
105 check_warning "$crlfnul" ${pfx}_CRLF_nul.err
108 commit_chk_wrnNNO () {
116 pfx=NNO_${crlf}_attr_${attr}
117 #Commit files on top of existing file
118 create_gitattributes "$attr" &&
119 for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
121 fname=${pfx}_$f.txt &&
123 git -c core.autocrlf=$crlf add $fname 2>/dev/null &&
124 git -c core.autocrlf=$crlf commit -m "commit_$fname" $fname >"${pfx}_$f.err" 2>&1
127 test_expect_success "commit NNO files crlf=$crlf attr=$attr LF" '
128 check_warning "$lfwarn" ${pfx}_LF.err
130 test_expect_success "commit NNO files crlf=$crlf attr=$attr CRLF" '
131 check_warning "$crlfwarn" ${pfx}_CRLF.err
134 test_expect_success "commit NNO files crlf=$crlf attr=$attr CRLF_mix_LF" '
135 check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
138 test_expect_success "commit NNO files crlf=$crlf attr=$attr LF_mix_cr" '
139 check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err
142 test_expect_success "commit NNO files crlf=$crlf attr=$attr CRLF_nul" '
143 check_warning "$crlfnul" ${pfx}_CRLF_nul.err
158 LF_mix_CR|CRLF_nul|LF_nul|CRLF_mix_CR)
162 echo error_invalid $1
168 check_files_in_repo () {
176 pfx=crlf_${crlf}_attr_${attr}_ &&
177 compare_files $lfname ${pfx}LF.txt &&
178 compare_files $crlfname ${pfx}CRLF.txt &&
179 compare_files $lfmixcrlf ${pfx}CRLF_mix_LF.txt &&
180 compare_files $lfmixcr ${pfx}LF_mix_CR.txt &&
181 compare_files $crlfnul ${pfx}CRLF_nul.txt
184 check_in_repo_NNO () {
192 pfx=NNO_${crlf}_attr_${attr}_
193 test_expect_success "compare_files $lfname ${pfx}LF.txt" '
194 compare_files $lfname ${pfx}LF.txt
196 test_expect_success "compare_files $crlfname ${pfx}CRLF.txt" '
197 compare_files $crlfname ${pfx}CRLF.txt
199 test_expect_success "compare_files $lfmixcrlf ${pfx}CRLF_mix_LF.txt" '
200 compare_files $lfmixcrlf ${pfx}CRLF_mix_LF.txt
202 test_expect_success "compare_files $lfmixcr ${pfx}LF_mix_CR.txt" '
203 compare_files $lfmixcr ${pfx}LF_mix_CR.txt
205 test_expect_success "compare_files $crlfnul ${pfx}CRLF_nul.txt" '
206 compare_files $crlfnul ${pfx}CRLF_nul.txt
219 create_gitattributes $attr &&
220 git config core.autocrlf $crlf &&
221 pfx=eol_${eol}_crlf_${crlf}_attr_${attr}_ &&
222 for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul
224 rm crlf_false_attr__$f.txt &&
225 if test -z "$eol"; then
226 git checkout crlf_false_attr__$f.txt
228 git -c core.eol=$eol checkout crlf_false_attr__$f.txt
232 test_expect_success "ls-files --eol $lfname ${pfx}LF.txt" '
233 test_when_finished "rm expect actual" &&
234 sort <<-EOF >expect &&
235 i/crlf w/$(stats_ascii $crlfname) crlf_false_attr__CRLF.txt
236 i/mixed w/$(stats_ascii $lfmixcrlf) crlf_false_attr__CRLF_mix_LF.txt
237 i/lf w/$(stats_ascii $lfname) crlf_false_attr__LF.txt
238 i/-text w/$(stats_ascii $lfmixcr) crlf_false_attr__LF_mix_CR.txt
239 i/-text w/$(stats_ascii $crlfnul) crlf_false_attr__CRLF_nul.txt
240 i/-text w/$(stats_ascii $crlfnul) crlf_false_attr__LF_nul.txt
242 git ls-files --eol crlf_false_attr__* |
243 sed -e "s!attr/[^ ]*!!g" -e "s/ / /g" -e "s/ */ /g" |
245 test_cmp expect actual
247 test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF" "
248 compare_ws_file $pfx $lfname crlf_false_attr__LF.txt
250 test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=CRLF" "
251 compare_ws_file $pfx $crlfname crlf_false_attr__CRLF.txt
253 test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=CRLF_mix_LF" "
254 compare_ws_file $pfx $lfmixcrlf crlf_false_attr__CRLF_mix_LF.txt
256 test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF_mix_CR" "
257 compare_ws_file $pfx $lfmixcr crlf_false_attr__LF_mix_CR.txt
259 test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF_nul" "
260 compare_ws_file $pfx $crlfnul crlf_false_attr__LF_nul.txt
264 # Test control characters
266 test_expect_success 'ls-files --eol -o Text/Binary' '
267 test_when_finished "rm expect actual TeBi_*" &&
268 STRT=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA &&
269 STR=$STRT$STRT$STRT$STRT &&
270 printf "${STR}BBB\001" >TeBi_127_S &&
271 printf "${STR}BBBB\001">TeBi_128_S &&
272 printf "${STR}BBB\032" >TeBi_127_E &&
273 printf "\032${STR}BBB" >TeBi_E_127 &&
274 printf "${STR}BBBB\000">TeBi_128_N &&
275 printf "${STR}BBB\012">TeBi_128_L &&
276 printf "${STR}BBB\015">TeBi_127_C &&
277 printf "${STR}BB\015\012" >TeBi_126_CL &&
278 printf "${STR}BB\015\012\015" >TeBi_126_CLC &&
279 sort <<-\EOF >expect &&
280 i/ w/-text TeBi_127_S
283 i/ w/-text TeBi_E_127
284 i/ w/-text TeBi_128_N
286 i/ w/-text TeBi_127_C
287 i/ w/crlf TeBi_126_CL
288 i/ w/-text TeBi_126_CLC
290 git ls-files --eol -o |
291 sed -n -e "/TeBi_/{s!attr/[ ]*!!g
296 test_cmp expect actual
299 test_expect_success 'setup master' '
300 echo >.gitattributes &&
301 git checkout -b master &&
302 git add .gitattributes &&
303 git commit -m "add .gitattributes" "" &&
304 printf "line1\nline2\nline3" >LF &&
305 printf "line1\r\nline2\r\nline3" >CRLF &&
306 printf "line1\r\nline2\nline3" >repoMIX &&
307 printf "line1\r\nline2\nline3" >CRLF_mix_LF &&
308 printf "line1\nline2\rline3" >LF_mix_CR &&
309 printf "line1\r\nline2\rline3" >CRLF_mix_CR &&
310 printf "line1Q\r\nline2\r\nline3" | q_to_nul >CRLF_nul &&
311 printf "line1Q\nline2\nline3" | q_to_nul >LF_nul &&
312 create_NNO_files CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF &&
313 git -c core.autocrlf=false add NNO_*.txt &&
314 git commit -m "mixed line endings" &&
320 warn_LF_CRLF="LF will be replaced by CRLF"
321 warn_CRLF_LF="CRLF will be replaced by LF"
323 # WILC stands for "Warn if (this OS) converts LF into CRLF".
324 # WICL: Warn if CRLF becomes LF
325 # WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
326 if test_have_prereq NATIVE_CRLF
337 # attr LF CRLF CRLFmixLF LFmixCR CRLFNUL
338 test_expect_success 'commit files empty attr' '
339 commit_check_warn false "" "" "" "" "" "" &&
340 commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
341 commit_check_warn input "" "" "CRLF_LF" "CRLF_LF" "" ""
344 test_expect_success 'commit files attr=auto' '
345 commit_check_warn false "auto" "$WILC" "$WICL" "$WAMIX" "" "" &&
346 commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
347 commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
350 test_expect_success 'commit files attr=text' '
351 commit_check_warn false "text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL" &&
352 commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
353 commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
356 test_expect_success 'commit files attr=-text' '
357 commit_check_warn false "-text" "" "" "" "" "" &&
358 commit_check_warn true "-text" "" "" "" "" "" &&
359 commit_check_warn input "-text" "" "" "" "" ""
362 test_expect_success 'commit files attr=lf' '
363 commit_check_warn false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
364 commit_check_warn true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
365 commit_check_warn input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
368 test_expect_success 'commit files attr=crlf' '
369 commit_check_warn false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
370 commit_check_warn true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
371 commit_check_warn input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
374 # attr LF CRLF CRLFmixLF LF_mix_CR CRLFNUL
375 commit_chk_wrnNNO false "" "" "" "" "" ""
376 commit_chk_wrnNNO true "" "LF_CRLF" "" "" "" ""
377 commit_chk_wrnNNO input "" "" "" "" "" ""
380 commit_chk_wrnNNO false "auto" "$WILC" "$WICL" "$WAMIX" "" ""
381 commit_chk_wrnNNO true "auto" "LF_CRLF" "" "LF_CRLF" "" ""
382 commit_chk_wrnNNO input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
384 commit_chk_wrnNNO false "text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL"
385 commit_chk_wrnNNO true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
386 commit_chk_wrnNNO input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
388 commit_chk_wrnNNO false "-text" "" "" "" "" ""
389 commit_chk_wrnNNO true "-text" "" "" "" "" ""
390 commit_chk_wrnNNO input "-text" "" "" "" "" ""
392 commit_chk_wrnNNO false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
393 commit_chk_wrnNNO true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
394 commit_chk_wrnNNO input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
396 commit_chk_wrnNNO false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
397 commit_chk_wrnNNO true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
398 commit_chk_wrnNNO input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
400 test_expect_success 'create files cleanup' '
402 git -c core.autocrlf=false reset --hard
405 test_expect_success 'commit empty gitattribues' '
406 check_files_in_repo false "" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
407 check_files_in_repo true "" LF LF LF LF_mix_CR CRLF_nul &&
408 check_files_in_repo input "" LF LF LF LF_mix_CR CRLF_nul
411 test_expect_success 'commit text=auto' '
412 check_files_in_repo false "auto" LF LF LF LF_mix_CR CRLF_nul &&
413 check_files_in_repo true "auto" LF LF LF LF_mix_CR CRLF_nul &&
414 check_files_in_repo input "auto" LF LF LF LF_mix_CR CRLF_nul
417 test_expect_success 'commit text' '
418 check_files_in_repo false "text" LF LF LF LF_mix_CR LF_nul &&
419 check_files_in_repo true "text" LF LF LF LF_mix_CR LF_nul &&
420 check_files_in_repo input "text" LF LF LF LF_mix_CR LF_nul
423 test_expect_success 'commit -text' '
424 check_files_in_repo false "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
425 check_files_in_repo true "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
426 check_files_in_repo input "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
429 # attr LF CRLF CRLF_mix_LF LF_mix_CR CRLFNUL
430 check_in_repo_NNO false "" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
431 check_in_repo_NNO true "" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
432 check_in_repo_NNO input "" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
434 check_in_repo_NNO false "auto" LF LF LF LF_mix_CR CRLF_nul
435 check_in_repo_NNO true "auto" LF LF LF LF_mix_CR CRLF_nul
436 check_in_repo_NNO input "auto" LF LF LF LF_mix_CR CRLF_nul
438 check_in_repo_NNO false "text" LF LF LF LF_mix_CR LF_nul
439 check_in_repo_NNO true "text" LF LF LF LF_mix_CR LF_nul
440 check_in_repo_NNO input "text" LF LF LF LF_mix_CR LF_nul
442 check_in_repo_NNO false "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
443 check_in_repo_NNO true "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
444 check_in_repo_NNO input "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
447 ################################################################################
448 # Check how files in the repo are changed when they are checked out
449 # How to read the table below:
450 # - checkout_files will check multiple files with a combination of settings
451 # and attributes (core.autocrlf=input is forbidden with core.eol=crlf)
452 # - parameter $1 : core.eol lf | crlf
453 # - parameter $2 : core.autocrlf false | true | input
454 # - parameter $3 : text in .gitattributs "" (empty) | auto | text | -text
455 # - parameter $4 : reference for a file with only LF in the repo
456 # - parameter $5 : reference for a file with only CRLF in the repo
457 # - parameter $6 : reference for a file with mixed LF and CRLF in the repo
458 # - parameter $7 : reference for a file with LF and CR in the repo (does somebody uses this ?)
459 # - parameter $8 : reference for a file with CRLF and a NUL (should be handled as binary when auto)
461 # What we have in the repo:
462 # ----------------- EOL in repo ----------------
463 # LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
464 # settings with checkout:
465 # core. core. .gitattr
467 # ----------------------------------------------
468 # What we want to have in the working tree:
469 if test_have_prereq NATIVE_CRLF
472 MIX_LF_CR=CRLF_mix_CR
476 MIX_CRLF_LF=CRLF_mix_LF
481 export CRLF_MIX_LF_CR MIX NL
483 checkout_files lf false "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
484 checkout_files lf true "" CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
485 checkout_files lf input "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
486 checkout_files lf false "auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
487 checkout_files lf true "auto" CRLF CRLF CRLF LF_mix_CR LF_nul
488 checkout_files lf input "auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
489 checkout_files lf false "text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
490 checkout_files lf true "text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
491 checkout_files lf input "text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
492 checkout_files lf false "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
493 checkout_files lf true "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
494 checkout_files lf input "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
495 checkout_files lf false "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
496 checkout_files lf true "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
497 checkout_files lf input "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
498 checkout_files lf false "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
499 checkout_files lf true "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
500 checkout_files lf input "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
502 checkout_files crlf false "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
503 checkout_files crlf true "" CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
504 checkout_files crlf false "auto" CRLF CRLF CRLF LF_mix_CR LF_nul
505 checkout_files crlf true "auto" CRLF CRLF CRLF LF_mix_CR LF_nul
506 checkout_files crlf false "text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
507 checkout_files crlf true "text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
508 checkout_files crlf false "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
509 checkout_files crlf true "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
510 checkout_files crlf false "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
511 checkout_files crlf true "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
512 checkout_files crlf false "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
513 checkout_files crlf true "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
515 checkout_files "" false "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
516 checkout_files "" true "" CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
517 checkout_files "" input "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
518 checkout_files "" false "auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR LF_nul
519 checkout_files "" true "auto" CRLF CRLF CRLF LF_mix_CR LF_nul
520 checkout_files "" input "auto" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
521 checkout_files "" false "text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR $LFNUL
522 checkout_files "" true "text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
523 checkout_files "" input "text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
524 checkout_files "" false "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
525 checkout_files "" true "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
526 checkout_files "" input "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
527 checkout_files "" false "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
528 checkout_files "" true "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
529 checkout_files "" input "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
530 checkout_files "" false "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
531 checkout_files "" true "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
532 checkout_files "" input "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
534 checkout_files native false "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
535 checkout_files native true "" CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
536 checkout_files native false "auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR LF_nul
537 checkout_files native true "auto" CRLF CRLF CRLF LF_mix_CR LF_nul
538 checkout_files native false "text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR $LFNUL
539 checkout_files native true "text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
540 checkout_files native false "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
541 checkout_files native true "-text" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
542 checkout_files native false "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
543 checkout_files native true "lf" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
544 checkout_files native false "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
545 checkout_files native true "crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
547 # Should be the last test case: remove some files from the worktree
548 test_expect_success 'ls-files --eol -d -z' '
549 rm crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt crlf_false_attr__LF.txt .gitattributes &&
550 cat >expect <<-\EOF &&
551 i/crlf w/ crlf_false_attr__CRLF.txt
552 i/lf w/ .gitattributes
553 i/lf w/ crlf_false_attr__LF.txt
554 i/mixed w/ crlf_false_attr__CRLF_mix_LF.txt
556 git ls-files --eol -d |
557 sed -e "s!attr/[^ ]*!!g" -e "s/ / /g" -e "s/ */ /g" |
559 test_cmp expect actual