git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 29, 2015, 08:17 UTC
Message-ID
<CAPig+cT-z8SyeY-pentrCHr=g3zt4cW9YOFxFs0nT9_C-QvFwg@mail.gmail.com>
In-Reply-To
<5659C32C.50007@web.de>
On Sat, Nov 28, 2015 at 10:07 AM, Torsten Bögershausen <tboegi@web.de> wrote:
Show 8 quoted lines
> 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...
Show 35 quoted lines
> +               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.
Show 19 quoted lines
> +       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
Show 14 quoted lines
> +       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
Previous: Torsten Bögershausen
Message 2 of 2 in “ls-files: Add eol diagnostics”
  1. ls-files: Add eol diagnosticsTorsten Bögershausen, Nov 28, 2015
  2. Eric SunshineNov 29, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.