git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: tboegi@web.de
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC v1 1/1] New way to normalize the line endings
Date: Tue, 29 Nov 2016 11:15:35 -0800	[thread overview]
Message-ID: <xmqqshqaf67c.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161127162245.11757-1-tboegi@web.de> (tboegi@web.de's message of "Sun, 27 Nov 2016 17:22:45 +0100")

tboegi@web.de writes:

> From: Torsten Bögershausen <tboegi@web.de>
>
> Sincec commit 6523728499e7 'convert: unify the "auto" handling of CRLF'
> the normalization instruction in Documentation/gitattributes.txt
> doesn't work any more.

Aside from s/Sincec/Since/, the above made it sound as if the named
commit was a regression that wants to be reverted, at least to my
first reading.  I think you want to be a bit more clear that we
updated the world order and made it a better place with that commit,
and examples in the doc need to be updated.  To convince readers
that, I think you would need to explain things like why the old way
illustrated in the example was bad, and why the new way is better.

> Update the documentation and add a test case.
>
> Reported by Kristian Adrup
> https://github.com/git-for-windows/git/issues/954
>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
>  Documentation/gitattributes.txt |  7 +++----
>  t/t0025-crlf-auto.sh            | 29 +++++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> index 976243a..1f7529a 100644
> --- a/Documentation/gitattributes.txt
> +++ b/Documentation/gitattributes.txt
> @@ -227,11 +227,10 @@ From a clean working directory:
>  
>  -------------------------------------------------
>  $ echo "* text=auto" >.gitattributes
> -$ rm .git/index     # Remove the index to force Git to
> -$ git reset         # re-scan the working directory
> +$ git ls-files --eol | egrep "i/(crlf|mixed)" # find not normalized files

Does this step help anything?  I do not see anything in the later
steps that the user uses the finding from the output of this step to
affect the end result.

> +$ rm .git/index     # Remove the index to re-scan the working directory
> +$ git add .

"A clean working directory" usually means all paths in the index
match what's in the working tree but this requires a bit more than
that, as this step ends up adding untracked and unignored paths.

>  $ git status        # Show files that will be normalized
> -$ git add -u
> -$ git add .gitattributes
>  $ git commit -m "Introduce end-of-line normalization"
>  -------------------------------------------------
>  
> diff --git a/t/t0025-crlf-auto.sh b/t/t0025-crlf-auto.sh
> index d0bee08..4ad4d02 100755
> --- a/t/t0025-crlf-auto.sh
> +++ b/t/t0025-crlf-auto.sh
> @@ -152,4 +152,33 @@ test_expect_success 'eol=crlf _does_ normalize binary files' '
>  	test -z "$LFwithNULdiff"
>  '
>  
> +test_expect_success 'prepare unnormalized' '
> +
> +	> .gitattributes &&

Lose SP before ".gitattributes".

> +	git config core.autocrlf false &&
> +	printf "LINEONE\nLINETWO\r\n"     >mixed &&
> +	git add mixed .gitattributes &&
> +	git commit -m "Add mixed" &&
> +	git ls-files --eol | egrep "i/crlf" &&
> +	git ls-files --eol | egrep "i/mixed"
> +
> +'

Any particular reason why we must use egrep not grep here?

> +
> +test_expect_success 'normalize unnormalized' '
> +	echo "* text=auto" >.gitattributes &&
> +	rm .git/index &&
> +	git add . &&
> +	git commit -m "Introduce end-of-line normalization" &&
> +	git ls-files --eol | tr "\\t" " " | sort >act &&
> +cat >exp <<EOF &&
> +i/-text w/-text attr/text=auto         LFwithNUL
> +i/lf    w/crlf  attr/text=auto         CRLFonly
> +i/lf    w/crlf  attr/text=auto         LFonly
> +i/lf    w/lf    attr/text=auto         .gitattributes
> +i/lf    w/mixed attr/text=auto         mixed
> +EOF

Use <<-EOF to indent the above 7 lines?

> +	test_cmp exp act
> +
> +'
> +
>  test_done

  reply	other threads:[~2016-11-29 19:15 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Message-Id=xmqqio26nqk8.fsf@gitster.mtv.corp.google.com>
2016-02-11 16:16 ` [PATCH 1/3] git reset --hard gives clean working tree tboegi
2016-02-11 18:49   ` Junio C Hamano
2016-03-05  7:23     ` Torsten Bögershausen
2016-03-05  8:05       ` Junio C Hamano
2016-03-05  8:27         ` Torsten Bögershausen
2016-03-05 21:18           ` Junio C Hamano
2016-03-07  8:14             ` Junio C Hamano
2016-03-07  8:51               ` Junio C Hamano
2016-03-07  8:58                 ` Torsten Bögershausen
2016-03-07 22:34                   ` Junio C Hamano
2016-03-29 13:25                     ` [PATCH v1 1/7] Make it possible to get sha1 for a path from the index tboegi
2016-03-29 13:28                       ` Duy Nguyen
2016-03-29 13:31                         ` Duy Nguyen
2016-03-29 15:05                           ` Torsten Bögershausen
2016-03-29 19:32                       ` Eric Sunshine
2016-03-29 13:25                     ` [PATCH v1 2/7] convert.c: stream and early out tboegi
2016-03-29 13:25                     ` [PATCH v1 3/7] Allow core.autocrlf=input and core.eol=crlf tboegi
2016-03-29 13:25                     ` [PATCH v1 4/7] t0027: TC for combined attributes tboegi
2016-03-29 13:25                     ` [PATCH v1 5/7] CRLF: unify the "auto" handling tboegi
2016-03-29 19:42                       ` Eric Sunshine
2016-03-29 13:25                     ` [PATCH v1 6/7] correct blame for files commited with CRLF tboegi
2016-03-29 17:21                       ` Junio C Hamano
2016-03-29 19:51                         ` Torsten Bögershausen
2016-03-29 19:58                           ` Junio C Hamano
2016-03-29 20:25                           ` Junio C Hamano
2016-03-29 20:32                             ` Junio C Hamano
2016-03-29 20:50                               ` Junio C Hamano
2016-03-30 17:48                                 ` Torsten Bögershausen
2016-03-29 13:25                     ` [PATCH v1 7/7] convert.c: more safer crlf handling with text attribute tboegi
2016-03-29 18:37                       ` Junio C Hamano
2016-04-01 16:08                     ` [PATCH v2 1/7] Make it possible to get sha1 for a path from the index tboegi
2016-04-01 16:08                     ` [PATCH v2 2/7] convert.c: stream and early out tboegi
2016-04-01 16:08                     ` [PATCH v2 3/7] Allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-01 22:20                       ` Junio C Hamano
2016-04-01 16:08                     ` [PATCH v2 4/7] t0027: TC for combined attributes tboegi
2016-04-01 22:22                       ` Junio C Hamano
2016-04-01 16:08                     ` [PATCH v2 5/7] CRLF: unify the "auto" handling tboegi
2016-04-01 22:25                       ` Junio C Hamano
2016-04-01 16:08                     ` [PATCH v2 6/7] correct blame for files commited with CRLF tboegi
2016-04-01 22:29                       ` Junio C Hamano
2016-04-03  9:29                         ` Torsten Bögershausen
2016-04-01 16:08                     ` [PATCH v2 7/7] convert.c: more safer crlf handling with text attribute tboegi
2016-04-05 19:23                     ` [PATCH v1] correct blame for files commited with CRLF tboegi
2016-04-05 20:57                       ` Junio C Hamano
2016-04-05 21:12                       ` Junio C Hamano
2016-04-06  4:17                         ` Torsten Bögershausen
2016-04-19 13:24                     ` [PATCH v5 1/4] t0027: Make more reliable tboegi
2016-04-19 13:26                     ` [PATCH v5 2/4] convert: allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-19 13:26                     ` [PATCH v5 3/4] t0027: test cases for combined attributes tboegi
2016-04-19 21:32                       ` Junio C Hamano
2016-04-20 15:52                         ` Torsten Bögershausen
2016-04-19 13:26                     ` [PATCH v5 4/4] convert.c: ident + core.autocrlf didn't work tboegi
2016-04-20 22:27                       ` Junio C Hamano
2016-04-22 14:38                     ` [PATCH v6 01/10] t0027: Make more reliable tboegi
2016-04-22 22:03                       ` Junio C Hamano
2016-04-24  3:45                         ` Torsten Bögershausen
2016-04-22 14:53                     ` [PATCH v6 02/10] convert: allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-22 14:53                     ` [PATCH v6 03/10] t0027: test cases for combined attributes tboegi
2016-04-22 14:53                     ` [PATCH v6 04/10] convert.c: ident + core.autocrlf didn't work tboegi
2016-04-22 14:53                     ` [PATCH v6 05/10] read-cache: factor out get_sha1_from_index() helper tboegi
2016-04-22 14:53                     ` [PATCH v6 06/10] convert.c: stream and early out tboegi
2016-04-22 14:53                     ` [PATCH v6 07/10] convert: unify the "auto" handling of CRLF tboegi
2016-04-22 14:53                     ` [PATCH v6 08/10] convert.c: more safer crlf handling with text attribute tboegi
2016-04-22 14:53                     ` [PATCH v6 09/10] t6038; use crlf on all platforms tboegi
2016-04-22 14:53                     ` [PATCH v6 10/10] ce_compare_data() did not respect conversion tboegi
2016-04-24 15:10                     ` [PATCH v6b 01/10] t0027: Make commit_chk_wrnNNO() reliable tboegi
2016-04-24 15:11                     ` [PATCH v6b 02/10] convert: allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-24 15:11                     ` [PATCH v6b 03/10] t0027: test cases for combined attributes tboegi
2016-04-24 15:11                     ` [PATCH v6b 04/10] convert.c: ident + core.autocrlf didn't work tboegi
2016-04-24 15:11                     ` [PATCH v6b 05/10] read-cache: factor out get_sha1_from_index() helper tboegi
2016-04-24 15:11                     ` [PATCH v6b 06/10] convert.c: stream and early out tboegi
2016-04-24 15:11                     ` [PATCH v6b 07/10] convert: unify the "auto" handling of CRLF tboegi
2016-04-24 15:11                     ` [PATCH v6b 08/10] convert.c: more safer crlf handling with text attribute tboegi
2016-04-24 15:11                     ` [PATCH v6b 09/10] t6038; use crlf on all platforms tboegi
2016-04-24 15:11                     ` [PATCH v6b 10/10] ce_compare_data() did not respect conversion tboegi
2016-04-25 16:56                     ` [PATCH v7 01/10] t0027: Make commit_chk_wrnNNO() reliable tboegi
2016-04-25 19:15                       ` Junio C Hamano
2016-04-25 16:56                     ` [PATCH v7 02/10] convert: allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-25 16:56                     ` [PATCH v7 03/10] t0027: test cases for combined attributes tboegi
2016-04-25 16:56                     ` [PATCH v7 04/10] convert.c: ident + core.autocrlf didn't work tboegi
2016-04-25 16:56                     ` [PATCH v7 05/10] read-cache: factor out get_sha1_from_index() helper tboegi
2016-04-25 16:56                     ` [PATCH v7 06/10] convert.c: stream and early out tboegi
2016-04-25 16:56                     ` [PATCH v7 07/10] convert: unify the "auto" handling of CRLF tboegi
2016-04-25 19:37                       ` Junio C Hamano
2016-04-26 16:33                         ` Torsten Bögershausen
2016-04-26 17:42                           ` Junio C Hamano
2016-04-25 16:56                     ` [PATCH v7 08/10] convert.c: more safer crlf handling with text attribute tboegi
2016-04-25 16:56                     ` [PATCH v7 09/10] t6038; use crlf on all platforms tboegi
2016-04-25 16:56                     ` [PATCH v7 10/10] ce_compare_data() did not respect conversion tboegi
2016-04-29 15:01                     ` [PATCH v8 01/10] t0027: make commit_chk_wrnNNO() reliable tboegi
2016-04-29 15:01                     ` [PATCH v8 02/10] convert: allow core.autocrlf=input and core.eol=crlf tboegi
2016-04-29 15:01                     ` [PATCH v8 03/10] t0027: test cases for combined attributes tboegi
2016-04-29 15:01                     ` [PATCH v8 04/10] convert.c: ident + core.autocrlf didn't work tboegi
2016-04-29 15:02                     ` [PATCH v8 05/10] read-cache: factor out get_sha1_from_index() helper tboegi
2016-04-29 15:02                     ` [PATCH v8 06/10] convert.c: stream and early out tboegi
2016-04-29 15:02                     ` [PATCH v8 07/10] convert: unify the "auto" handling of CRLF tboegi
2016-11-25 15:48                       ` Torsten Bögershausen
2016-11-27 16:22                         ` [PATCH/RFC v1 1/1] New way to normalize the line endings tboegi
2016-11-29 19:15                           ` Junio C Hamano [this message]
2017-04-12 11:48                         ` [PATCH v2 1/1] Document how " tboegi
2016-04-29 15:02                     ` [PATCH v8 08/10] convert.c: more safer crlf handling with text attribute tboegi
2016-04-29 15:02                     ` [PATCH v8 09/10] t6038; use crlf on all platforms tboegi
2016-04-29 15:02                     ` [PATCH v8 10/10] ce_compare_data() did not respect conversion tboegi
2016-04-29 18:20                       ` Junio C Hamano
2016-04-29 21:09                       ` Junio C Hamano
2016-05-01 16:27                         ` Torsten Bögershausen
2016-05-02 18:16                           ` Junio C Hamano
2016-05-02 19:33                             ` Junio C Hamano
2016-05-03 16:02                               ` Torsten Bögershausen
2016-05-03 18:31                                 ` Junio C Hamano
2016-05-04  4:07                                   ` Torsten Bögershausen
2016-05-04  7:23                                     ` Junio C Hamano
2016-05-06  8:54                                       ` Torsten Bögershausen
2016-05-06 17:11                                         ` Junio C Hamano
2016-05-07  6:10                     ` [PATCH v9 0/6] convert-eol-autocrlf, old 5..10 now 1..6 tboegi
2016-05-07  6:10                     ` [PATCH v9 1/6] read-cache: factor out get_sha1_from_index() helper tboegi
2016-05-09 19:54                       ` Junio C Hamano
2016-05-07  6:11                     ` [PATCH v9 2/6] convert.c: stream and early out tboegi
2016-05-09 20:29                       ` Junio C Hamano
2016-05-11  4:30                         ` Torsten Bögershausen
2016-05-07  6:11                     ` [PATCH v9 3/6] convert: unify the "auto" handling of CRLF tboegi
2016-05-07  6:11                     ` [PATCH v9 4/6] convert.c: more safer crlf handling with text attribute tboegi
2016-05-07  6:11                     ` [PATCH v9 5/6] t6038; use crlf on all platforms tboegi
2016-05-07  6:11                     ` [PATCH v9 6/6] convert: ce_compare_data() checks for a sha1 of a path tboegi
2016-02-11 16:16 ` [PATCH 2/3] Factor out convert_cmp_checkout() into convert.c tboegi
2016-02-11 16:16 ` [PATCH 3/3] convert.c: Optimize convert_cmp_checkout() for changed file len tboegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqshqaf67c.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).