Re: [PATCH] t6023-merge-file: Work around non-portable sed usage

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

 



Arjen Laarhoven wrote:
> OS X sed doesn't understand '\n' on the right side of a substitution.
> Use a valid substitution character instead and use 'tr' to convert
> those to a newline.
> 
> Signed-off-by: Arjen Laarhoven <arjen@xxxxxxxx>
> ---
> This patch prevents the "diff3 -m" feature in next (commit
> e0af48e49682ea) from breaking the tests which are added in that
> commit.
> 
>  t/t6023-merge-file.sh |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
> index 42620e0..5e18d68 100755
> --- a/t/t6023-merge-file.sh
> +++ b/t/t6023-merge-file.sh
> @@ -150,8 +150,8 @@ test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
>  
>  '
>  
> -sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit;/" < new6.txt > new8.txt
> -sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit --/" < new7.txt > new9.txt
> +sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt
> +sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt
>  
>  test_expect_success 'ZEALOUS_ALNUM' '
>  

I was just encountering this myself.

sed can be fixed without the use of tr by replacing '\n' with an explicit newline like:

sed -e 's/deerit./&\
\
\
\
/' -e "s/locavit,/locavit;/" < new6.txt > new8.txt

Of course it doesn't fit on one line though.

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

[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