Merge branch 'kn/ref-filter-atom-parsing'
[alt-git.git] / t / t0027-auto-crlf.sh
blob504e5a02a1d930238023bc2fc7a582183f237674
1 #!/bin/sh
3 test_description='CRLF conversion all combinations'
5 . ./test-lib.sh
7 if ! test_have_prereq EXPENSIVE
8 then
9 skip_all="EXPENSIVE not set"
10 test_done
13 compare_files () {
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
20 compare_ws_file () {
21 pfx=$1
22 exp=$2.expect
23 act=$pfx.actual.$3
24 tr '\015\000' QN <"$2" >"$exp" &&
25 tr '\015\000' QN <"$3" >"$act" &&
26 test_cmp $exp $act &&
27 rm $exp $act
30 create_gitattributes () {
31 attr=$1
32 case "$attr" in
33 auto)
34 echo "*.txt text=auto" >.gitattributes
36 text)
37 echo "*.txt text" >.gitattributes
39 -text)
40 echo "*.txt -text" >.gitattributes
42 crlf)
43 echo "*.txt eol=crlf" >.gitattributes
45 lf)
46 echo "*.txt eol=lf" >.gitattributes
48 "")
49 echo >.gitattributes
52 echo >&2 invalid attribute: $attr
53 exit 1
55 esac
58 create_NNO_files () {
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
69 done
70 done
73 check_warning () {
74 case "$1" in
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 ;;
77 '') >"$2".expect ;;
78 *) echo >&2 "Illegal 1": "$1" ; return false ;;
79 esac
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 () {
85 crlf=$1
86 attr=$2
87 lfname=$3
88 crlfname=$4
89 lfmixcrlf=$5
90 lfmixcr=$6
91 crlfnul=$7
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 &&
97 cp $f $fname &&
98 git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
99 done &&
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 () {
109 crlf=$1
110 attr=$2
111 lfwarn=$3
112 crlfwarn=$4
113 lfmixcrlf=$5
114 lfmixcr=$6
115 crlfnul=$7
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 &&
122 cp $f $fname &&
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
125 done
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
147 stats_ascii () {
148 case "$1" in
150 echo lf
152 CRLF)
153 echo crlf
155 CRLF_mix_LF)
156 echo mixed
158 LF_mix_CR|CRLF_nul|LF_nul|CRLF_mix_CR)
159 echo "-text"
162 echo error_invalid $1
164 esac
168 check_files_in_repo () {
169 crlf=$1
170 attr=$2
171 lfname=$3
172 crlfname=$4
173 lfmixcrlf=$5
174 lfmixcr=$6
175 crlfnul=$7
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 () {
185 crlf=$1
186 attr=$2
187 lfname=$3
188 crlfname=$4
189 lfmixcrlf=$5
190 lfmixcr=$6
191 crlfnul=$7
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
210 checkout_files () {
211 eol=$1
212 crlf=$2
213 attr=$3
214 lfname=$4
215 crlfname=$5
216 lfmixcrlf=$6
217 lfmixcr=$7
218 crlfnul=$8
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
227 else
228 git -c core.eol=$eol checkout crlf_false_attr__$f.txt
230 done
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" |
244 sort >actual &&
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
265 # NUL SOH CR EOF==^Z
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
281 i/ w/none TeBi_128_S
282 i/ w/none TeBi_127_E
283 i/ w/-text TeBi_E_127
284 i/ w/-text TeBi_128_N
285 i/ w/lf TeBi_128_L
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
292 s! ! !g
293 s! *! !g
295 }" | sort >actual &&
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" &&
315 test_tick
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
327 then
328 WILC=LF_CRLF
329 WICL=
330 WAMIX=LF_CRLF
331 else
332 WILC=
333 WICL=CRLF_LF
334 WAMIX=CRLF_LF
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' '
401 rm -f *.txt &&
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
466 # eol acrlf
467 # ----------------------------------------------
468 # What we want to have in the working tree:
469 if test_have_prereq NATIVE_CRLF
470 then
471 MIX_CRLF_LF=CRLF
472 MIX_LF_CR=CRLF_mix_CR
473 NL=CRLF
474 LFNUL=CRLF_nul
475 else
476 MIX_CRLF_LF=CRLF_mix_LF
477 MIX_LF_CR=LF_mix_CR
478 NL=LF
479 LFNUL=LF_nul
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" |
558 sort >actual &&
559 test_cmp expect actual
562 test_done