[GSoC] [PATCH v2 0/2] avoid pipes with Git on LHS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



changes since v1:
* replaced "wc -l" with test_stdout_line_count 
* removed unnecessary "()" subshells

Shubham Mishra (2):
  t0001-t0028: avoid pipes with Git on LHS
  t0030-t0050: avoid pipes with Git on LHS

 t/t0000-basic.sh            | 10 +++--
 t/t0022-crlf-rename.sh      |  4 +-
 t/t0025-crlf-renormalize.sh |  4 +-
 t/t0027-auto-crlf.sh        | 12 +++---
 t/t0030-stripspace.sh       | 75 ++++++++++++++++++++++++-------------
 t/t0050-filesystem.sh       |  3 +-
 6 files changed, 66 insertions(+), 42 deletions(-)

Range-diff against v1:
1:  2a219ace42 = 1:  2a219ace42 t0001-t0028: avoid pipes with Git on LHS
2:  d08c144476 ! 2:  c90fc271d9 t0030-t0050: avoid pipes with Git on LHS
    @@ Commit message
         Signed-off-by: Shubham Mishra <shivam828787@xxxxxxxxx>
     
      ## t/t0030-stripspace.sh ##
    +@@ t/t0030-stripspace.sh: s40='                                        '
    + sss="$s40$s40$s40$s40$s40$s40$s40$s40$s40$s40" # 400
    + ttt="$t40$t40$t40$t40$t40$t40$t40$t40$t40$t40" # 400
    + 
    ++printf_git_stripspace () {
    ++    printf "$1" | git stripspace
    ++}
    ++
    + test_expect_success \
    +     'long lines without spaces should be unchanged' '
    +     echo "$ttt" >expect &&
     @@ t/t0030-stripspace.sh: test_expect_success \
      
      test_expect_success \
    @@ t/t0030-stripspace.sh: test_expect_success \
     -    test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
     -    test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
     -    test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0
    -+    printf "$ttt" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt$ttt" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt$ttt$ttt" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$ttt"
      '
      
      # text plus spaces at the end:
    @@ t/t0030-stripspace.sh: test_expect_success \
     -    test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&
     -    test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&
     -    test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0
    -+    printf "$ttt$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt$ttt$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$sss$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$ttt$sss$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0 &&
    -+    printf "$ttt$sss$sss$sss" | git stripspace >tmp &&
    -+    test $(wc -l <tmp) -gt 0
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$sss" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss$sss" &&
    ++    test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss$sss"
      '
      
      test_expect_success \
    @@ t/t0030-stripspace.sh: test_expect_success \
     -    ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep "  " >/dev/null) &&
     -    ! (printf "$ttt$sss$sss$sss" | git stripspace | grep "  " >/dev/null)
     +    printf "$ttt$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    printf "$ttt$ttt$sss" | git stripspace &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    printf "$ttt$ttt$ttt$sss" | git stripspace &&
    -+    ! (grep "  " tmp >/dev/nul) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    printf "$ttt$sss$sss" | git stripspace &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    printf "$ttt$ttt$sss$sss" | git stripspace &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    printf "$ttt$sss$sss$sss" | git stripspace &&
    -+    ! (grep "  " tmp >/dev/null)
    ++    ! grep "  " tmp >/dev/null
      '
      
      test_expect_success \
    @@ t/t0030-stripspace.sh: test_expect_success \
     -    ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep "  " >/dev/null) &&
     -    ! (echo "$ttt$sss$sss$sss" | git stripspace | grep "  " >/dev/null)
     +    echo "$ttt$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    echo "$ttt$ttt$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp>/dev/null) &&
    ++    ! grep "  " tmp>/dev/null &&
     +    echo "$ttt$ttt$ttt$sss" &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    echo "$ttt$sss$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    echo "$ttt$ttt$sss$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp >/dev/null) &&
    ++    ! grep "  " tmp >/dev/null &&
     +    echo "$ttt$sss$sss$sss" | git stripspace >tmp &&
    -+    ! (grep "  " tmp >/dev/null)
    ++    ! grep "  " tmp >/dev/null
      '
      
      test_expect_success \
    @@ t/t0030-stripspace.sh: test_expect_success \
     -    ! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) &&
     -    ! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null)
     +    printf "" | git stripspace >tmp &&
    -+    ! ( grep " " tmp >/dev/null) &&
    ++    ! grep " " tmp >/dev/null &&
     +    printf "$sss" | git stripspace >tmp &&
    -+    ! ( grep " " tmp >/dev/null) &&
    ++    ! grep " " tmp >/dev/null &&
     +    printf "$sss$sss" | git stripspace >tmp &&
    -+    ! (grep " " tmp >/dev/null) &&
    ++    ! grep " " tmp >/dev/null &&
     +    printf "$sss$sss$sss" | git stripspace >tmp &&
    -+    ! (grep " " tmp >/dev/null) &&
    ++    ! grep " " tmp >/dev/null &&
     +    printf "$sss$sss$sss$sss" | git stripspace >tmp &&
    -+    ! (grep " " tmp >/dev/null)
    ++    ! grep " " tmp >/dev/null
      '
      
      test_expect_success \
-- 
2.25.1




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux