Re: [PATCH v5] ls-files: Add eol diagnostics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 28, 2015 at 10:07 AM, Torsten Bögershausen <tboegi@xxxxxx> wrote:
> diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
> @@ -213,7 +238,20 @@ checkout_files () {
>                         git -c core.eol=$eol checkout $src$f.txt
>                 fi
>         done
> -
> +       test_expect_success "ls-files --eol $lfname ${pfx}LF.txt" "
> +               cat >e <<-EOF &&

This here-doc requires interpolation, hence -EOF is fine, however...

> +               i/text-crlf w/$(stats_ascii $crlfname) ${src}CRLF.txt
> +               i/text-crlf-lf w/$(stats_ascii $lfmixcrlf) ${src}CRLF_mix_LF.txt
> +               i/text-lf w/$(stats_ascii $lfname) ${src}LF.txt
> +               i/binary w/$(stats_ascii $lfmixcr) ${src}LF_mix_CR.txt
> +               i/binary w/$(stats_ascii $crlfnul) ${src}CRLF_nul.txt
> +               i/binary w/$(stats_ascii $crlfnul) ${src}LF_nul.txt
> +               EOF
> +               sort <e >expect &&
> +               git ls-files --eol $src* | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&
> +               test_cmp expect actual &&
> +               rm e expect actual
> +       "
>         test_expect_success "checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF" "
>                 compare_ws_file $pfx $lfname    ${src}LF.txt
>         "
> @@ -231,6 +269,37 @@ checkout_files () {
>         "
>  }
>
> +# Test control characters
> +# NUL SOH CR EOF==^Z
> +test_expect_success 'ls-files --eol -o Text/Binary' '
> +       test_when_finished "rm e expect actual TeBi_*" &&
> +       STRT=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA &&
> +       STR=$STRT$STRT$STRT$STRT &&
> +       printf "${STR}BBB\001" >TeBi_127_S &&
> +       printf "${STR}BBBB\001">TeBi_128_S &&
> +       printf "${STR}BBB\032" >TeBi_127_E &&
> +       printf "\032${STR}BBB" >TeBi_E_127 &&
> +       printf "${STR}BBBB\000">TeBi_128_N &&
> +       printf "${STR}BBB\012">TeBi_128_L &&
> +       printf "${STR}BBB\015">TeBi_127_C &&
> +       printf "${STR}BB\015\012" >TeBi_126_CL &&
> +       printf "${STR}BB\015\012\015" >TeBi_126_CLC &&
> +       cat >e <<-EOF &&

Nit: [1] suggested using -\EOF since this here-doc needs no interpolation.

> +       i/ w/binary TeBi_127_S
> +       i/ w/text-no-eol TeBi_128_S
> +       i/ w/text-no-eol TeBi_127_E
> +       i/ w/binary TeBi_E_127
> +       i/ w/binary TeBi_128_N
> +       i/ w/text-lf TeBi_128_L
> +       i/ w/binary TeBi_127_C
> +       i/ w/text-crlf TeBi_126_CL
> +       i/ w/binary TeBi_126_CLC
> +       EOF
> +       sort <e >expect &&
> +       git ls-files --eol -o | egrep "TeBi_" | sed -e 's!attr/[=a-z-]*!!g' -e "s/  */ /g" | sort >actual &&
> +       test_cmp expect actual
> +'
> @@ -480,4 +549,20 @@ checkout_files    native  true  "lf"      LF    CRLF  CRLF_mix_LF  LF_mix_CR
> +# Should be the last test case
> +test_expect_success 'ls-files --eol -d' "
> +       rm  crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt crlf_false_attr__LF.txt .gitattributes &&
> +       cat >expect <<-EOF &&

Likewise.

[1]: http://marc.info/?l=git&m=144829967800565&w=2

> +       i/text-crlf w/ crlf_false_attr__CRLF.txt
> +       i/text-crlf-lf w/ crlf_false_attr__CRLF_mix_LF.txt
> +       i/text-lf w/ .gitattributes
> +       i/text-lf w/ crlf_false_attr__LF.txt
> +       EOF
> +       git ls-files --eol -d | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&
> +       test_cmp expect actual &&
> +       rm expect actual
> +"
> +
> +
>  test_done
> --
> 2.6.2.403.gd7a84e3
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]