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

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

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Sep 8, 2008, 19:06 UTC
Message-ID
<cNVNi0DglMtk8yH2LYJQdUZ7rfXlu4pff2TkbJj4KU6hnx-n_IQ3nw@cipher.nrlssc.navy.mil>
In-Reply-To
<1220898558-73783-1-git-send-email-arjen@yaph.org>
Arjen Laarhoven wrote:
Show 28 quoted lines
> 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@yaph.org>
> ---
> 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
Previous: Arjen LaarhovenNext: Arjen Laarhoven
Message 2 of 4 in “t6023-merge-file: Work around non-portable sed usage”
  1. t6023-merge-file: Work around non-portable sed usageArjen Laarhoven, Sep 8, 2008
  2. Brandon CaseySep 8, 2008
  3. Arjen LaarhovenSep 8, 2008
  4. Junio C HamanoSep 8, 2008

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.