git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: tboegi@web.de
To: git@vger.kernel.org
Cc: "Torsten Bögershausen" <tboegi@web.de>
Subject: [PATCH v1 1/1] t0027: Rename NotNormalized (NNO) into CRLF in index
Date: Fri, 19 Aug 2016 11:41:30 +0200	[thread overview]
Message-ID: <20160819094130.21140-1-tboegi@web.de> (raw)
In-Reply-To: <20160809114938.pcrvirrzrh6ldmnr@sigill.intra.peff.net>

From: Torsten Bögershausen <tboegi@web.de>

Originally NNO stands for content, that had been commited
"Not NOrmalized", in other words files with CRLF in the index.

Make more clear what should be tested:
- commit a file with CRLF into the index
- Change the content in the working tree
- Run "git add" and check for the conversion warnings
- Repeat for different content (text, LF, CRLF, mixed) and
  binary (LF and lone CR, CRLF with NUL)

Rename commit_chk_wrnNNO() into CRI_add_chk_wrn() and rename NNO into CRI.

Integrate create_NNO_files() into 'setup master'

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 t/t0027-auto-crlf.sh | 122 +++++++++++++++++++++++++--------------------------
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 90db54c..bfcf14b 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -49,24 +49,6 @@ create_gitattributes () {
 	} >.gitattributes
 }
 
-create_NNO_files () {
-	for crlf in false true input
-	do
-		for attr in "" auto text -text
-		do
-			for aeol in "" lf crlf
-			do
-				pfx=NNO_attr_${attr}_aeol_${aeol}_${crlf}
-				cp CRLF_mix_LF ${pfx}_LF.txt &&
-				cp CRLF_mix_LF ${pfx}_CRLF.txt &&
-				cp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&
-				cp CRLF_mix_LF ${pfx}_LF_mix_CR.txt &&
-				cp CRLF_mix_LF ${pfx}_CRLF_nul.txt
-			done
-		done
-	done
-}
-
 check_warning () {
 	case "$1" in
 	LF_CRLF) echo "warning: LF will be replaced by CRLF" >"$2".expect ;;
@@ -102,7 +84,7 @@ commit_check_warn () {
 	check_warning "$crlfnul" ${pfx}_CRLF_nul.err
 }
 
-commit_chk_wrnNNO () {
+CRI_add_chk_wrn () {
 	attr=$1 ; shift
 	aeol=$1 ; shift
 	crlf=$1 ; shift
@@ -111,7 +93,7 @@ commit_chk_wrnNNO () {
 	lfmixcrlf=$1 ; shift
 	lfmixcr=$1 ; shift
 	crlfnul=$1 ; shift
-	pfx=NNO_attr_${attr}_aeol_${aeol}_${crlf}
+	pfx=CRI_attr_${attr}_aeol_${aeol}_${crlf}
 	#Commit files on top of existing file
 	create_gitattributes "$attr" $aeol &&
 	for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
@@ -122,22 +104,22 @@ commit_chk_wrnNNO () {
 		git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
 	done
 
-	test_expect_success "commit NNO files crlf=$crlf attr=$attr LF" '
+	test_expect_success "CRLF in index add file crlf=$crlf attr=$attr LF" '
 		check_warning "$lfwarn" ${pfx}_LF.err
 	'
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF" '
+	test_expect_success "CRLF in index add file attr=$attr aeol=$aeol crlf=$crlf CRLF" '
 		check_warning "$crlfwarn" ${pfx}_CRLF.err
 	'
 
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_mix_LF" '
+	test_expect_success "CRLF in index add file attr=$attr aeol=$aeol crlf=$crlf CRLF_mix_LF" '
 		check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
 	'
 
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf LF_mix_cr" '
+	test_expect_success "CRLF in index add file attr=$attr aeol=$aeol crlf=$crlf LF_mix_cr" '
 		check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err
 	'
 
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_nul" '
+	test_expect_success "CRLF in index add file attr=$attr aeol=$aeol crlf=$crlf CRLF_nul" '
 		check_warning "$crlfnul" ${pfx}_CRLF_nul.err
 	'
 }
@@ -199,7 +181,7 @@ check_files_in_repo () {
 	compare_files $crlfnul ${pfx}CRLF_nul.txt
 }
 
-check_in_repo_NNO () {
+check_in_repo_CRI () {
 	attr=$1 ; shift
 	aeol=$1 ; shift
 	crlf=$1 ; shift
@@ -208,7 +190,7 @@ check_in_repo_NNO () {
 	lfmixcrlf=$1 ; shift
 	lfmixcr=$1 ; shift
 	crlfnul=$1 ; shift
-	pfx=NNO_attr_${attr}_aeol_${aeol}_${crlf}
+	pfx=CRI_attr_${attr}_aeol_${aeol}_${crlf}
 	test_expect_success "compare_files $lfname ${pfx}_LF.txt" '
 		compare_files $lfname ${pfx}_LF.txt
 	'
@@ -329,8 +311,22 @@ test_expect_success 'setup master' '
 	printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONE\r\nLINETWO\rLINETHREE"   >CRLF_mix_CR &&
 	printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONEQ\r\nLINETWO\r\nLINETHREE" | q_to_nul >CRLF_nul &&
 	printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONEQ\nLINETWO\nLINETHREE" | q_to_nul >LF_nul &&
-	create_NNO_files CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF CRLF_mix_LF &&
-	git -c core.autocrlf=false add NNO_*.txt &&
+	for crlf in false true input
+	do
+		for attr in "" auto text -text
+		do
+			for aeol in "" lf crlf
+			do
+				pfx=CRI_attr_${attr}_aeol_${aeol}_${crlf}
+				cp CRLF_mix_LF ${pfx}_LF.txt &&
+				cp CRLF_mix_LF ${pfx}_CRLF.txt &&
+				cp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&
+				cp CRLF_mix_LF ${pfx}_LF_mix_CR.txt &&
+				cp CRLF_mix_LF ${pfx}_CRLF_nul.txt
+			done
+		done
+	done &&
+	git -c core.autocrlf=false add CRI_*.txt &&
 	git commit -m "mixed line endings" &&
 	test_tick
 '
@@ -391,33 +387,37 @@ test_expect_success 'commit files attr=crlf' '
 	commit_check_warn input "crlf" "LF_CRLF" ""        "LF_CRLF" "LF_CRLF" ""
 '
 
-#                 attr                    LF        CRLF      CRLFmixLF   LF_mix_CR   CRLFNUL
-commit_chk_wrnNNO ""      ""      false   ""        ""        ""          ""          ""
-commit_chk_wrnNNO ""      ""      true    LF_CRLF   ""        ""          ""          ""
-commit_chk_wrnNNO ""      ""      input   ""        ""        ""          ""          ""
-
-commit_chk_wrnNNO "auto"  ""      false   "$WILC"   ""        ""          ""          ""
-commit_chk_wrnNNO "auto"  ""      true    LF_CRLF   ""        ""          ""          ""
-commit_chk_wrnNNO "auto"  ""      input   ""        ""        ""          ""          ""
+# Files had been commited with CRLF. run "git add" with different content and
+# check if
+# warning: LF will be replaced by CRLF or
+# warning: CRLF will be replaced by LF are written to stderr
+#               attr                    LF        CRLF      CRLFmixLF   LF_mix_CR   CRLFNUL
+CRI_add_chk_wrn ""      ""      false   ""        ""        ""          ""          ""
+CRI_add_chk_wrn ""      ""      true    LF_CRLF   ""        ""          ""          ""
+CRI_add_chk_wrn ""      ""      input   ""        ""        ""          ""          ""
+
+CRI_add_chk_wrn "auto"  ""      false   "$WILC"   ""        ""          ""          ""
+CRI_add_chk_wrn "auto"  ""      true    LF_CRLF   ""        ""          ""          ""
+CRI_add_chk_wrn "auto"  ""      input   ""        ""        ""          ""          ""
 for crlf in true false input
 do
-	commit_chk_wrnNNO -text ""      $crlf   ""        ""        ""          ""          ""
-	commit_chk_wrnNNO -text lf      $crlf   ""        ""        ""          ""          ""
-	commit_chk_wrnNNO -text crlf    $crlf   ""        ""        ""          ""          ""
-	commit_chk_wrnNNO ""    lf      $crlf   ""       CRLF_LF    CRLF_LF      ""         CRLF_LF
-	commit_chk_wrnNNO ""    crlf    $crlf   LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
-	commit_chk_wrnNNO auto  lf    	$crlf   ""        ""        ""          ""          ""
-	commit_chk_wrnNNO auto  crlf  	$crlf   LF_CRLF   ""        ""          ""          ""
-	commit_chk_wrnNNO text  lf    	$crlf   ""       CRLF_LF    CRLF_LF     ""          CRLF_LF
-	commit_chk_wrnNNO text  crlf  	$crlf   LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
+	CRI_add_chk_wrn -text ""      $crlf   ""        ""        ""          ""          ""
+	CRI_add_chk_wrn -text lf      $crlf   ""        ""        ""          ""          ""
+	CRI_add_chk_wrn -text crlf    $crlf   ""        ""        ""          ""          ""
+	CRI_add_chk_wrn ""    lf      $crlf   ""        CRLF_LF   CRLF_LF      ""         CRLF_LF
+	CRI_add_chk_wrn ""    crlf    $crlf   LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
+	CRI_add_chk_wrn auto  lf    	$crlf   ""        ""        ""          ""          ""
+	CRI_add_chk_wrn auto  crlf  	$crlf   LF_CRLF   ""        ""          ""          ""
+	CRI_add_chk_wrn text  lf    	$crlf   ""        CRLF_LF   CRLF_LF     ""          CRLF_LF
+	CRI_add_chk_wrn text  crlf  	$crlf   LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
 done
 
-commit_chk_wrnNNO "text"  ""      false   "$WILC"   "$WICL"   "$WAMIX"    "$WILC"     "$WICL"
-commit_chk_wrnNNO "text"  ""      true    LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
-commit_chk_wrnNNO "text"  ""      input   ""        CRLF_LF   CRLF_LF     ""          CRLF_LF
+CRI_add_chk_wrn   text  ""      false   "$WILC"   "$WICL"   "$WAMIX"    "$WILC"     "$WICL"
+CRI_add_chk_wrn   text  ""      true    LF_CRLF   ""        LF_CRLF     LF_CRLF     ""
+CRI_add_chk_wrn   text  ""      input   ""        CRLF_LF   CRLF_LF     ""          CRLF_LF
 
-test_expect_success 'commit NNO and cleanup' '
-	git commit -m "commit files on top of NNO" &&
+test_expect_success 'commit files with CRLF in index CRI and cleanup' '
+	git commit -m "commit files on top of CRLF" &&
 	rm -f *.txt &&
 	git -c core.autocrlf=false reset --hard
 '
@@ -449,16 +449,16 @@ test_expect_success 'commit -text' '
 for crlf in true false input
 do
 	#                 attr  aeol           LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLFNUL
-	check_in_repo_NNO ""    ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO -text ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO -text lf     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO -text crlf   $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO auto  ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO auto  lf     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO auto  crlf   $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
-	check_in_repo_NNO text  ""     $crlf   LF  LF    LF           LF_mix_CR  LF_nul
-	check_in_repo_NNO text  lf     $crlf   LF  LF    LF           LF_mix_CR  LF_nul
-	check_in_repo_NNO text  crlf   $crlf   LF  LF    LF           LF_mix_CR  LF_nul
+	check_in_repo_CRI ""    ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI -text ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI -text lf     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI -text crlf   $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI auto  ""     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI auto  lf     $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI auto  crlf   $crlf   LF  CRLF  CRLF_mix_LF  LF_mix_CR  CRLF_nul
+	check_in_repo_CRI text  ""     $crlf   LF  LF    LF           LF_mix_CR  LF_nul
+	check_in_repo_CRI text  lf     $crlf   LF  LF    LF           LF_mix_CR  LF_nul
+	check_in_repo_CRI text  crlf   $crlf   LF  LF    LF           LF_mix_CR  LF_nul
 done
 ################################################################################
 # Check how files in the repo are changed when they are checked out
-- 
2.9.3.599.g2376d31.dirty


  parent reply	other threads:[~2016-08-19  9:38 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 15:05 t0027 racy? Johannes Schindelin
2016-08-08 15:29 ` Jeff King
2016-08-08 20:32   ` Torsten Bögershausen
2016-08-09  6:51     ` Jeff King
2016-08-09  7:03       ` Jeff King
2016-08-09 11:27         ` Johannes Schindelin
2016-08-09 11:33       ` Torsten Bögershausen
2016-08-09 11:49         ` Jeff King
2016-08-09 12:59           ` Torsten Bögershausen
2016-08-09 13:27             ` Jeff King
2016-08-09 21:28               ` Torsten Bögershausen
2016-08-10 12:28                 ` Johannes Schindelin
2016-08-11 18:58                   ` Torsten Bögershausen
2016-08-11 19:34                     ` Junio C Hamano
2016-08-12  7:24                     ` Jeff King
2016-08-12 16:50           ` [PATCH v1 0/2] Fix conversion warnings tboegi
2016-08-12 16:51           ` [PATCH v1 1/2] t0027: Correct raciness in NNO test tboegi
2016-08-12 17:56             ` Junio C Hamano
2016-08-13 16:50             ` Johannes Sixt
2016-08-13 21:18               ` Torsten Bögershausen
2016-08-14 20:37                 ` Junio C Hamano
2016-08-12 16:51           ` [PATCH v1 2/2] convert: missing `LF will be replaced by CRLF tboegi
2016-08-12 17:52             ` Junio C Hamano
2016-08-13 21:29           ` [PATCH v2 0/1] convert: Correct NNO tests and missing `LF will be replaced by CRLF` tboegi
2016-08-17 12:46             ` Johannes Schindelin
2016-08-13 21:29           ` [PATCH v2 1/1] " tboegi
2016-08-19  9:41           ` [PATCH v1 0/1] Rename NotNormalized (NNO) into CRLF in index tboegi
2016-08-19 16:39             ` Junio C Hamano
2016-08-19  9:41           ` tboegi [this message]
2016-08-25 15:52           ` [PATCH v1 0/3] Update eol documentation tboegi
2016-08-25 20:31             ` Junio C Hamano
2016-08-26  1:00               ` Jacob Keller
2016-08-26  7:03               ` Torsten Bögershausen
2016-08-25 15:52           ` [PATCH v1 1/2] git ls-files: text=auto eol=lf is supported in Git 2.10 tboegi
2016-08-25 20:38             ` Junio C Hamano
2016-08-25 15:52           ` [PATCH v1 2/2] gitattributes: Document the unified "auto" handling tboegi
2016-08-25 20:46             ` Junio C Hamano
2016-08-26 20:18               ` [PATCH v2 0/2] Adjust the documentation to " tboegi
2016-08-26 20:18               ` [PATCH v2 1/2] git ls-files: text=auto eol=lf is supported in Git 2.10 tboegi
2016-08-26 20:18               ` [PATCH v2 2/2] gitattributes: Document the unified "auto" handling tboegi
2016-08-26 20:53                 ` Junio C Hamano
2016-08-09 11:33   ` t0027 racy? Johannes Schindelin
2016-08-09 11:38     ` Jeff King
2016-08-08 18:24 ` Torsten Bögershausen
2016-08-09 11:25   ` Johannes Schindelin

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=20160819094130.21140-1-tboegi@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    /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).