From: Torsten Bögershausen <tbo...@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 <tbo...@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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to