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

[PATCH v1 1/1] t0027: Rename NotNormalized (NNO) into CRLF in index

From
tboegi@web.de <tboegi@web.de>
Date
Aug 19, 2016, 09:41 UTC
Message-ID
<20160819094130.21140-1-tboegi@web.de>
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
Previous: Junio C HamanoNext: tboegi@web.de
Message 29 of 45 in “t0027 racy?”
  1. Johannes SchindelinAug 8, 2016
  2. Jeff KingAug 8, 2016
  3. Torsten BögershausenAug 8, 2016
  4. Jeff KingAug 9, 2016
  5. Jeff KingAug 9, 2016
  6. Johannes SchindelinAug 9, 2016
  7. Torsten BögershausenAug 9, 2016
  8. Jeff KingAug 9, 2016
  9. Torsten BögershausenAug 9, 2016
  10. Jeff KingAug 9, 2016
  11. Torsten BögershausenAug 9, 2016
  12. Johannes SchindelinAug 10, 2016
  13. Torsten BögershausenAug 11, 2016
  14. Junio C HamanoAug 11, 2016
  15. Jeff KingAug 12, 2016
  16. 0/2 Fix conversion warningstboegi@web.de, Aug 12, 2016
  17. 2/2 convert: missing `LF will be replaced by CRLFtboegi@web.de, Aug 12, 2016
  18. Junio C HamanoAug 12, 2016
  19. 1/2 t0027: Correct raciness in NNO testtboegi@web.de, Aug 12, 2016
  20. Junio C HamanoAug 12, 2016
  21. Johannes SixtAug 13, 2016
  22. Torsten BögershausenAug 13, 2016
  23. Junio C HamanoAug 14, 2016
  24. 1/1 convert: Correct NNO tests and missing `LF will be replaced by CRLF`tboegi@web.de, Aug 13, 2016
  25. 0/1 convert: Correct NNO tests and missing `LF will be replaced by CRLF`tboegi@web.de, Aug 13, 2016
  26. Johannes SchindelinAug 17, 2016
  27. 0/1 Rename NotNormalized (NNO) into CRLF in indextboegi@web.de, Aug 19, 2016
  28. Junio C HamanoAug 19, 2016
  29. 1/1 t0027: Rename NotNormalized (NNO) into CRLF in indextboegi@web.de, Aug 19, 2016
  30. 1/2 git ls-files: text=auto eol=lf is supported in Git 2.10tboegi@web.de, Aug 25, 2016
  31. Junio C HamanoAug 25, 2016
  32. 0/3 Update eol documentationtboegi@web.de, Aug 25, 2016
  33. Junio C HamanoAug 25, 2016
  34. Jacob KellerAug 26, 2016
  35. Torsten BögershausenAug 26, 2016
  36. 2/2 gitattributes: Document the unified "auto" handlingtboegi@web.de, Aug 25, 2016
  37. Junio C HamanoAug 25, 2016
  38. 0/2 Adjust the documentation to the unified "auto" handlingtboegi@web.de, Aug 26, 2016
  39. 1/2 git ls-files: text=auto eol=lf is supported in Git 2.10tboegi@web.de, Aug 26, 2016
  40. 2/2 gitattributes: Document the unified "auto" handlingtboegi@web.de, Aug 26, 2016
  41. Junio C HamanoAug 26, 2016
  42. Johannes SchindelinAug 9, 2016
  43. Jeff KingAug 9, 2016
  44. Torsten BögershausenAug 8, 2016
  45. Johannes SchindelinAug 9, 2016

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.