Re: [PATCH v2 2/2] t0030-t0050: avoid pipes with Git on LHS

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

 



Am 27.02.22 um 13:24 schrieb Shubham Mishra:
>  test_expect_success \
>      'text plus spaces without newline at end should not show spaces' '
> -    ! (printf "$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (printf "$ttt$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (printf "$ttt$sss$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (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 &&
> +    printf "$ttt$ttt$sss" | git stripspace &&
> +    ! grep "  " tmp >/dev/null &&
> +    printf "$ttt$ttt$ttt$sss" | git stripspace &&
> +    ! grep "  " tmp >/dev/null &&
> +    printf "$ttt$sss$sss" | git stripspace &&
> +    ! grep "  " tmp >/dev/null &&
> +    printf "$ttt$ttt$sss$sss" | git stripspace &&
> +    ! grep "  " tmp >/dev/null &&
> +    printf "$ttt$sss$sss$sss" | git stripspace &&
> +    ! grep "  " tmp >/dev/null
>  '

You forgot to redirect all but the first `git stripspace`.

>  
>  test_expect_success \
> @@ -282,12 +292,18 @@ test_expect_success \
>  
>  test_expect_success \
>      'text plus spaces at end should not show spaces' '
> -    ! (echo "$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (echo "$ttt$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (echo "$ttt$sss$sss" | git stripspace | grep "  " >/dev/null) &&
> -    ! (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 &&
> +    echo "$ttt$ttt$sss" | git stripspace >tmp &&
> +    ! grep "  " tmp>/dev/null &&
> +    echo "$ttt$ttt$ttt$sss" &&
> +    ! grep "  " tmp >/dev/null &&
> +    echo "$ttt$sss$sss" | git stripspace >tmp &&
> +    ! grep "  " tmp >/dev/null &&
> +    echo "$ttt$ttt$sss$sss" | git stripspace >tmp &&
> +    ! grep "  " tmp >/dev/null &&
> +    echo "$ttt$sss$sss$sss" | git stripspace >tmp &&
> +    ! grep "  " tmp >/dev/null
>  '

A superficial glance at the visual pattern formed by the new lines
reveals immediately that there is something foul. And indeed, one of the
rewritten cases misses `| git stripspace >tmp`.

-- Hannes



[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