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\000abcdef0123456789' QN00000000000000000
<"$2" >"$exp" &&
25 tr '\015\000abcdef0123456789' QN00000000000000000
<"$3" >"$act" &&
26 test_cmp
"$exp" "$act" &&
30 create_gitattributes
() {
35 auto
) echo '*.txt text=auto' ;;
36 ident
) echo '*.txt ident' ;;
37 text
) echo '*.txt text' ;;
38 -text) echo '*.txt -text' ;;
39 crlf
) echo '*.txt eol=crlf' ;;
40 lf
) echo '*.txt eol=lf' ;;
43 echo >&2 invalid attribute
: "$1"
53 for crlf
in false true input
55 for attr
in "" auto text
-text lf crlf
57 pfx
=NNO_
${crlf}_attr_
${attr} &&
58 cp CRLF_mix_LF
${pfx}_LF.txt
&&
59 cp CRLF_mix_LF
${pfx}_CRLF.txt
&&
60 cp CRLF_mix_LF
${pfx}_CRLF_mix_LF.txt
&&
61 cp CRLF_mix_LF
${pfx}_LF_mix_CR.txt
&&
62 cp CRLF_mix_LF
${pfx}_CRLF_nul.txt
69 LF_CRLF
) echo "warning: LF will be replaced by CRLF" >"$2".expect
;;
70 CRLF_LF
) echo "warning: CRLF will be replaced by LF" >"$2".expect
;;
72 *) echo >&2 "Illegal 1": "$1" ; return false
;;
74 grep "will be replaced by" "$2" |
sed -e "s/\(.*\) in [^ ]*$/\1/" |
uniq >"$2".actual
75 test_cmp
"$2".expect
"$2".actual
78 commit_check_warn
() {
86 pfx
=crlf_
${crlf}_attr_
${attr}
87 create_gitattributes
"$attr" &&
88 for f
in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul
90 fname
=${pfx}_
$f.txt
&&
92 git
-c core.autocrlf
=$crlf add
$fname 2>"${pfx}_$f.err"
94 git commit
-m "core.autocrlf $crlf" &&
95 check_warning
"$lfname" ${pfx}_LF.err
&&
96 check_warning
"$crlfname" ${pfx}_CRLF.err
&&
97 check_warning
"$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
&&
98 check_warning
"$lfmixcr" ${pfx}_LF_mix_CR.err
&&
99 check_warning
"$crlfnul" ${pfx}_CRLF_nul.err
102 commit_chk_wrnNNO
() {
110 pfx
=NNO_
${crlf}_attr_
${attr}
111 #Commit files on top of existing file
112 create_gitattributes
"$attr" &&
113 for f
in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
115 fname
=${pfx}_
$f.txt
&&
117 git
-c core.autocrlf
=$crlf add
$fname 2>/dev
/null
&&
118 git
-c core.autocrlf
=$crlf commit
-m "commit_$fname" $fname >"${pfx}_$f.err" 2>&1
121 test_expect_success
"commit NNO files crlf=$crlf attr=$attr LF" '
122 check_warning "$lfwarn" ${pfx}_LF.err
124 test_expect_success
"commit NNO files crlf=$crlf attr=$attr CRLF" '
125 check_warning "$crlfwarn" ${pfx}_CRLF.err
128 test_expect_success
"commit NNO files crlf=$crlf attr=$attr CRLF_mix_LF" '
129 check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
132 test_expect_success
"commit NNO files crlf=$crlf attr=$attr LF_mix_cr" '
133 check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err
136 test_expect_success
"commit NNO files crlf=$crlf attr=$attr CRLF_nul" '
137 check_warning "$crlfnul" ${pfx}_CRLF_nul.err
152 LF_mix_CR|CRLF_nul|LF_nul|CRLF_mix_CR
)
156 echo error_invalid
$1
163 # contruct the attr/ returned by git ls-files --eol
164 # Take none (=empty), one or two args
167 -text,*) echo "-text" ;;
168 text
,) echo "text" ;;
169 text
,lf
) echo "text eol=lf" ;;
170 text
,crlf
) echo "text eol=crlf" ;;
171 auto
,) echo "text=auto" ;;
172 auto
,lf
) echo "text=auto eol=lf" ;;
173 auto
,crlf
) echo "text=auto eol=crlf" ;;
174 lf
,) echo "text eol=lf" ;;
175 crlf
,) echo "text eol=crlf" ;;
177 *) echo invalid_attr
"$1,$2" ;;
181 check_files_in_repo
() {
189 pfx
=crlf_
${crlf}_attr_
${attr}_
&&
190 compare_files
$lfname ${pfx}LF.txt
&&
191 compare_files
$crlfname ${pfx}CRLF.txt
&&
192 compare_files
$lfmixcrlf ${pfx}CRLF_mix_LF.txt
&&
193 compare_files
$lfmixcr ${pfx}LF_mix_CR.txt
&&
194 compare_files
$crlfnul ${pfx}CRLF_nul.txt
197 check_in_repo_NNO
() {
205 pfx
=NNO_
${crlf}_attr_
${attr}_
206 test_expect_success
"compare_files $lfname ${pfx}LF.txt" '
207 compare_files $lfname ${pfx}LF.txt
209 test_expect_success
"compare_files $crlfname ${pfx}CRLF.txt" '
210 compare_files $crlfname ${pfx}CRLF.txt
212 test_expect_success
"compare_files $lfmixcrlf ${pfx}CRLF_mix_LF.txt" '
213 compare_files $lfmixcrlf ${pfx}CRLF_mix_LF.txt
215 test_expect_success
"compare_files $lfmixcr ${pfx}LF_mix_CR.txt" '
216 compare_files $lfmixcr ${pfx}LF_mix_CR.txt
218 test_expect_success
"compare_files $crlfnul ${pfx}CRLF_nul.txt" '
219 compare_files $crlfnul ${pfx}CRLF_nul.txt
234 create_gitattributes
"$attr" "$ident" &&
235 git config core.autocrlf
$crlf &&
236 pfx
=eol_
${ceol}_crlf_${crlf}_attr_${attr}_
&&
237 for f
in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul
239 rm crlf_false_attr__
$f.txt
&&
240 if test -z "$ceol"; then
241 git checkout crlf_false_attr__
$f.txt
243 git
-c core.eol
=$ceol checkout crlf_false_attr__
$f.txt
247 test_expect_success
"ls-files --eol attr=$attr $ident $aeol core.autocrlf=$crlf core.eol=$ceol" '
248 test_when_finished "rm expect actual" &&
249 sort <<-EOF >expect &&
250 i/crlf w/$(stats_ascii $crlfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF.txt
251 i/mixed w/$(stats_ascii $lfmixcrlf) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_mix_LF.txt
252 i/lf w/$(stats_ascii $lfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF.txt
253 i/-text w/$(stats_ascii $lfmixcr) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_mix_CR.txt
254 i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_nul.txt
255 i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_nul.txt
257 git ls-files --eol crlf_false_attr__* |
258 sed -e "s/ / /g" -e "s/ */ /g" |
260 test_cmp expect actual
262 test_expect_success
"checkout $ident $attr $aeol core.autocrlf=$crlf core.eol=$ceol file=LF" "
263 compare_ws_file $pfx $lfname crlf_false_attr__LF.txt
265 test_expect_success
"checkout $ident $attr $aeol core.autocrlf=$crlf core.eol=$ceol file=CRLF" "
266 compare_ws_file $pfx $crlfname crlf_false_attr__CRLF.txt
268 test_expect_success
"checkout $ident $attr $aeol core.autocrlf=$crlf core.eol=$ceol file=CRLF_mix_LF" "
269 compare_ws_file $pfx $lfmixcrlf crlf_false_attr__CRLF_mix_LF.txt
271 test_expect_success
"checkout $ident $attr $aeol core.autocrlf=$crlf core.eol=$ceol file=LF_mix_CR" "
272 compare_ws_file $pfx $lfmixcr crlf_false_attr__LF_mix_CR.txt
274 test_expect_success
"checkout $ident $attr $aeol core.autocrlf=$crlf core.eol=$ceol file=LF_nul" "
275 compare_ws_file $pfx $crlfnul crlf_false_attr__LF_nul.txt
279 # Test control characters
281 test_expect_success
'ls-files --eol -o Text/Binary' '
282 test_when_finished "rm expect actual TeBi_*" &&
283 STRT=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA &&
284 STR=$STRT$STRT$STRT$STRT &&
285 printf "${STR}BBB\001" >TeBi_127_S &&
286 printf "${STR}BBBB\001">TeBi_128_S &&
287 printf "${STR}BBB\032" >TeBi_127_E &&
288 printf "\032${STR}BBB" >TeBi_E_127 &&
289 printf "${STR}BBBB\000">TeBi_128_N &&
290 printf "${STR}BBB\012">TeBi_128_L &&
291 printf "${STR}BBB\015">TeBi_127_C &&
292 printf "${STR}BB\015\012" >TeBi_126_CL &&
293 printf "${STR}BB\015\012\015" >TeBi_126_CLC &&
294 sort <<-\EOF >expect &&
295 i/ w/-text TeBi_127_S
298 i/ w/-text TeBi_E_127
299 i/ w/-text TeBi_128_N
301 i/ w/-text TeBi_127_C
302 i/ w/crlf TeBi_126_CL
303 i/ w/-text TeBi_126_CLC
305 git ls-files --eol -o |
306 sed -n -e "/TeBi_/{s!attr/[ ]*!!g
311 test_cmp expect actual
314 test_expect_success
'setup master' '
315 echo >.gitattributes &&
316 git checkout -b master &&
317 git add .gitattributes &&
318 git commit -m "add .gitattributes" "" &&
319 printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\nLINETHREE" >LF &&
320 printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONE\r\nLINETWO\r\nLINETHREE" >CRLF &&
321 printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\r\nLINETWO\nLINETHREE" >CRLF_mix_LF &&
322 printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\rLINETHREE" >LF_mix_CR &&
323 printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONE\r\nLINETWO\rLINETHREE" >CRLF_mix_CR &&
324 printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONEQ\r\nLINETWO\r\nLINETHREE" | q_to_nul >CRLF_nul &&
325 printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONEQ\nLINETWO\nLINETHREE" | q_to_nul >LF_nul &&
326 create_NNO_files CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF &&
327 git -c core.autocrlf=false add NNO_*.txt &&
328 git commit -m "mixed line endings" &&
334 warn_LF_CRLF
="LF will be replaced by CRLF"
335 warn_CRLF_LF
="CRLF will be replaced by LF"
337 # WILC stands for "Warn if (this OS) converts LF into CRLF".
338 # WICL: Warn if CRLF becomes LF
339 # WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
340 if test_have_prereq NATIVE_CRLF
351 # attr LF CRLF CRLFmixLF LFmixCR CRLFNUL
352 test_expect_success
'commit files empty attr' '
353 commit_check_warn false "" "" "" "" "" "" &&
354 commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
355 commit_check_warn input "" "" "CRLF_LF" "CRLF_LF" "" ""
358 test_expect_success
'commit files attr=auto' '
359 commit_check_warn false "auto" "$WILC" "$WICL" "$WAMIX" "" "" &&
360 commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
361 commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
364 test_expect_success
'commit files attr=text' '
365 commit_check_warn false "text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL" &&
366 commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
367 commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
370 test_expect_success
'commit files attr=-text' '
371 commit_check_warn false "-text" "" "" "" "" "" &&
372 commit_check_warn true "-text" "" "" "" "" "" &&
373 commit_check_warn input "-text" "" "" "" "" ""
376 test_expect_success
'commit files attr=lf' '
377 commit_check_warn false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
378 commit_check_warn true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
379 commit_check_warn input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
382 test_expect_success
'commit files attr=crlf' '
383 commit_check_warn false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
384 commit_check_warn true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
385 commit_check_warn input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
388 # attr LF CRLF CRLFmixLF LF_mix_CR CRLFNUL
389 commit_chk_wrnNNO false
"" "" "" "" "" ""
390 commit_chk_wrnNNO true
"" "LF_CRLF" "" "" "" ""
391 commit_chk_wrnNNO input
"" "" "" "" "" ""
394 commit_chk_wrnNNO false
"auto" "$WILC" "$WICL" "$WAMIX" "" ""
395 commit_chk_wrnNNO true
"auto" "LF_CRLF" "" "LF_CRLF" "" ""
396 commit_chk_wrnNNO input
"auto" "" "CRLF_LF" "CRLF_LF" "" ""
398 commit_chk_wrnNNO false
"text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL"
399 commit_chk_wrnNNO true
"text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
400 commit_chk_wrnNNO input
"text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
402 commit_chk_wrnNNO false
"-text" "" "" "" "" ""
403 commit_chk_wrnNNO true
"-text" "" "" "" "" ""
404 commit_chk_wrnNNO input
"-text" "" "" "" "" ""
406 commit_chk_wrnNNO false
"lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
407 commit_chk_wrnNNO true
"lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
408 commit_chk_wrnNNO input
"lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
410 commit_chk_wrnNNO false
"crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
411 commit_chk_wrnNNO true
"crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
412 commit_chk_wrnNNO input
"crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
414 test_expect_success
'create files cleanup' '
416 git -c core.autocrlf=false reset --hard
419 test_expect_success
'commit empty gitattribues' '
420 check_files_in_repo false "" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
421 check_files_in_repo true "" LF LF LF LF_mix_CR CRLF_nul &&
422 check_files_in_repo input "" LF LF LF LF_mix_CR CRLF_nul
425 test_expect_success
'commit text=auto' '
426 check_files_in_repo false "auto" LF LF LF LF_mix_CR CRLF_nul &&
427 check_files_in_repo true "auto" LF LF LF LF_mix_CR CRLF_nul &&
428 check_files_in_repo input "auto" LF LF LF LF_mix_CR CRLF_nul
431 test_expect_success
'commit text' '
432 check_files_in_repo false "text" LF LF LF LF_mix_CR LF_nul &&
433 check_files_in_repo true "text" LF LF LF LF_mix_CR LF_nul &&
434 check_files_in_repo input "text" LF LF LF LF_mix_CR LF_nul
437 test_expect_success
'commit -text' '
438 check_files_in_repo false "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
439 check_files_in_repo true "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul &&
440 check_files_in_repo input "-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
443 # attr LF CRLF CRLF_mix_LF LF_mix_CR CRLFNUL
444 check_in_repo_NNO false
"" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
445 check_in_repo_NNO true
"" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
446 check_in_repo_NNO input
"" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
448 check_in_repo_NNO false
"auto" LF LF LF LF_mix_CR CRLF_nul
449 check_in_repo_NNO true
"auto" LF LF LF LF_mix_CR CRLF_nul
450 check_in_repo_NNO input
"auto" LF LF LF LF_mix_CR CRLF_nul
452 check_in_repo_NNO false
"text" LF LF LF LF_mix_CR LF_nul
453 check_in_repo_NNO true
"text" LF LF LF LF_mix_CR LF_nul
454 check_in_repo_NNO input
"text" LF LF LF LF_mix_CR LF_nul
456 check_in_repo_NNO false
"-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
457 check_in_repo_NNO true
"-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
458 check_in_repo_NNO input
"-text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
461 ################################################################################
462 # Check how files in the repo are changed when they are checked out
463 # How to read the table below:
464 # - checkout_files will check multiple files with a combination of settings
465 # and attributes (core.autocrlf=input is forbidden with core.eol=crlf)
467 # - parameter $1 : text in .gitattributs "" (empty) | auto | text | -text
468 # - parameter $2 : ident "" | i (i == ident)
469 # - parameter $3 : eol in .gitattributs "" (empty) | lf | crlf
470 # - parameter $4 : core.autocrlf false | true | input
471 # - parameter $5 : core.eol "" | lf | crlf | "native"
472 # - parameter $6 : reference for a file with only LF in the repo
473 # - parameter $7 : reference for a file with only CRLF in the repo
474 # - parameter $8 : reference for a file with mixed LF and CRLF in the repo
475 # - parameter $9 : reference for a file with LF and CR in the repo
476 # - parameter $10 : reference for a file with CRLF and a NUL (should be handled as binary when auto)
478 if test_have_prereq NATIVE_CRLF
481 MIX_LF_CR
=CRLF_mix_CR
485 MIX_CRLF_LF
=CRLF_mix_LF
490 export CRLF_MIX_LF_CR MIX NL
492 checkout_files
"" "" "" false
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
493 checkout_files
"" "" "" false crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
494 checkout_files
"" "" "" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
495 checkout_files
"" "" "" false native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
496 checkout_files
"" "" "" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
497 checkout_files
"" "" "" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
498 checkout_files
"" "" "" true
"" CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
499 checkout_files
"" "" "" true crlf CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
500 checkout_files
"" "" "" true lf CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
501 checkout_files
"" "" "" true native CRLF CRLF CRLF_mix_LF LF_mix_CR LF_nul
502 checkout_files
"" ident
"" false
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
503 checkout_files
"" ident
"" false crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
504 checkout_files
"" ident
"" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
505 checkout_files
"" ident
"" false native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
506 checkout_files
"" ident
"" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
507 checkout_files
"" ident
"" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
508 checkout_files
"" ident
"" true
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
509 checkout_files
"" ident
"" true crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
510 checkout_files
"" ident
"" true lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
511 checkout_files
"" ident
"" true native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
512 checkout_files
"auto" "" "" false
"" $NL CRLF
$MIX_CRLF_LF LF_mix_CR LF_nul
513 checkout_files
"auto" "" "" false crlf CRLF CRLF CRLF LF_mix_CR LF_nul
514 checkout_files
"auto" "" "" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
515 checkout_files
"auto" "" "" false native
$NL CRLF
$MIX_CRLF_LF LF_mix_CR LF_nul
516 checkout_files
"auto" "" "" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
517 checkout_files
"auto" "" "" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
518 checkout_files
"auto" "" "" true
"" CRLF CRLF CRLF LF_mix_CR LF_nul
519 checkout_files
"auto" "" "" true crlf CRLF CRLF CRLF LF_mix_CR LF_nul
520 checkout_files
"auto" "" "" true lf CRLF CRLF CRLF LF_mix_CR LF_nul
521 checkout_files
"auto" "" "" true native CRLF CRLF CRLF LF_mix_CR LF_nul
522 checkout_files
"auto" ident
"" false
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
523 checkout_files
"auto" ident
"" false crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
524 checkout_files
"auto" ident
"" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
525 checkout_files
"auto" ident
"" false native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
526 checkout_files
"auto" ident
"" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
527 checkout_files
"auto" ident
"" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
528 checkout_files
"auto" ident
"" true
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
529 checkout_files
"auto" ident
"" true crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
530 checkout_files
"auto" ident
"" true lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
531 checkout_files
"auto" ident
"" true native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
535 checkout_files
"crlf" "$id" "" false
"" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
536 checkout_files
"crlf" "$id" "" false crlf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
537 checkout_files
"crlf" "$id" "" false lf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
538 checkout_files
"crlf" "$id" "" false native CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
539 checkout_files
"crlf" "$id" "" input
"" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
540 checkout_files
"crlf" "$id" "" input lf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
541 checkout_files
"crlf" "$id" "" true
"" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
542 checkout_files
"crlf" "$id" "" true crlf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
543 checkout_files
"crlf" "$id" "" true lf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
544 checkout_files
"crlf" "$id" "" true native CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
545 checkout_files
"lf" "$id" "" false
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
546 checkout_files
"lf" "$id" "" false crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
547 checkout_files
"lf" "$id" "" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
548 checkout_files
"lf" "$id" "" false native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
549 checkout_files
"lf" "$id" "" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
550 checkout_files
"lf" "$id" "" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
551 checkout_files
"lf" "$id" "" true
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
552 checkout_files
"lf" "$id" "" true crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
553 checkout_files
"lf" "$id" "" true lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
554 checkout_files
"lf" "$id" "" true native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
555 checkout_files
"text" "$id" "" false
"" $NL CRLF
$MIX_CRLF_LF $MIX_LF_CR $LFNUL
556 checkout_files
"text" "$id" "" false crlf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
557 checkout_files
"text" "$id" "" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
558 checkout_files
"text" "$id" "" false native
$NL CRLF
$MIX_CRLF_LF $MIX_LF_CR $LFNUL
559 checkout_files
"text" "$id" "" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
560 checkout_files
"text" "$id" "" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
561 checkout_files
"text" "$id" "" true
"" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
562 checkout_files
"text" "$id" "" true crlf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
563 checkout_files
"text" "$id" "" true lf CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
564 checkout_files
"text" "$id" "" true native CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
565 checkout_files
"-text" "$id" "" false
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
566 checkout_files
"-text" "$id" "" false crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
567 checkout_files
"-text" "$id" "" false lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
568 checkout_files
"-text" "$id" "" false native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
569 checkout_files
"-text" "$id" "" input
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
570 checkout_files
"-text" "$id" "" input lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
571 checkout_files
"-text" "$id" "" true
"" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
572 checkout_files
"-text" "$id" "" true crlf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
573 checkout_files
"-text" "$id" "" true lf LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
574 checkout_files
"-text" "$id" "" true native LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
577 # Should be the last test case: remove some files from the worktree
578 test_expect_success
'ls-files --eol -d -z' '
579 rm crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt crlf_false_attr__LF.txt .gitattributes &&
580 cat >expect <<-\EOF &&
581 i/crlf w/ crlf_false_attr__CRLF.txt
582 i/lf w/ .gitattributes
583 i/lf w/ crlf_false_attr__LF.txt
584 i/mixed w/ crlf_false_attr__CRLF_mix_LF.txt
586 git ls-files --eol -d |
587 sed -e "s!attr/[^ ]*!!g" -e "s/ / /g" -e "s/ */ /g" |
589 test_cmp expect actual