{"thread":{"id":"15433","subject":"[PATCH] t6023-merge-file: Work around non-portable sed usage","startedAt":"2008-09-08T18:29:18Z","lastAt":"2008-09-08T19:26:32Z","messageCount":4,"participants":["Arjen Laarhoven","Brandon Casey","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"90118","messageId":"1220898558-73783-1-git-send-email-arjen@yaph.org","threadId":"15433","inReplyTo":null,"subject":"[PATCH] t6023-merge-file: Work around non-portable sed usage","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2008-09-08T18:29:18Z","receivedAt":"2008-09-08T18:29:18Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"OS X sed doesn't understand '\\n' on the right side of a substitution.\nUse a valid substitution character instead and use 'tr' to convert\nthose to a newline.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\nThis patch prevents the \"diff3 -m\" feature in next (commit\ne0af48e49682ea) from breaking the tests which are added in that\ncommit.\n\n t/t6023-merge-file.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh\nindex 42620e0..5e18d68 100755\n--- a/t/t6023-merge-file.sh\n+++ b/t/t6023-merge-file.sh\n@@ -150,8 +150,8 @@ test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '\n \n '\n \n-sed -e 's/deerit./&\\n\\n\\n\\n/' -e \"s/locavit,/locavit;/\" < new6.txt > new8.txt\n-sed -e 's/deerit./&\\n\\n\\n\\n/' -e \"s/locavit,/locavit --/\" < new7.txt > new9.txt\n+sed -e 's/deerit./&%%%%/' -e \"s/locavit,/locavit;/\"< new6.txt | tr '%' '\\012' > new8.txt\n+sed -e 's/deerit./&%%%%/' -e \"s/locavit,/locavit --/\" < new7.txt | tr '%' '\\012' > new9.txt\n \n test_expect_success 'ZEALOUS_ALNUM' '\n \n-- \n1.6.0.1.402.ga75a\n"},{"id":"90122","messageId":"cNVNi0DglMtk8yH2LYJQdUZ7rfXlu4pff2TkbJj4KU6hnx-n_IQ3nw@cipher.nrlssc.navy.mil","threadId":"15433","inReplyTo":"1220898558-73783-1-git-send-email-arjen@yaph.org","subject":"Re: [PATCH] t6023-merge-file: Work around non-portable sed usage","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-08T19:06:02Z","receivedAt":"2008-09-08T19:06:02Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Arjen Laarhoven wrote:\n> OS X sed doesn't understand '\\n' on the right side of a substitution.\n> Use a valid substitution character instead and use 'tr' to convert\n> those to a newline.\n> \n> Signed-off-by: Arjen Laarhoven <arjen@yaph.org>\n> ---\n> This patch prevents the \"diff3 -m\" feature in next (commit\n> e0af48e49682ea) from breaking the tests which are added in that\n> commit.\n> \n>  t/t6023-merge-file.sh |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh\n> index 42620e0..5e18d68 100755\n> --- a/t/t6023-merge-file.sh\n> +++ b/t/t6023-merge-file.sh\n> @@ -150,8 +150,8 @@ test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '\n>  \n>  '\n>  \n> -sed -e 's/deerit./&\\n\\n\\n\\n/' -e \"s/locavit,/locavit;/\" < new6.txt > new8.txt\n> -sed -e 's/deerit./&\\n\\n\\n\\n/' -e \"s/locavit,/locavit --/\" < new7.txt > new9.txt\n> +sed -e 's/deerit./&%%%%/' -e \"s/locavit,/locavit;/\"< new6.txt | tr '%' '\\012' > new8.txt\n> +sed -e 's/deerit./&%%%%/' -e \"s/locavit,/locavit --/\" < new7.txt | tr '%' '\\012' > new9.txt\n>  \n>  test_expect_success 'ZEALOUS_ALNUM' '\n>  \n\nI was just encountering this myself.\n\nsed can be fixed without the use of tr by replacing '\\n' with an explicit newline like:\n\nsed -e 's/deerit./&\\\n\\\n\\\n\\\n/' -e \"s/locavit,/locavit;/\" < new6.txt > new8.txt\n\nOf course it doesn't fit on one line though.\n\n-brandon\n"},{"id":"90126","messageId":"20080908192313.GB4148@regex.yaph.org","threadId":"15433","inReplyTo":"cNVNi0DglMtk8yH2LYJQdUZ7rfXlu4pff2TkbJj4KU6hnx-n_IQ3nw@cipher.nrlssc.navy.mil","subject":"Re: [PATCH] t6023-merge-file: Work around non-portable sed usage","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2008-09-08T19:23:13Z","receivedAt":"2008-09-08T19:23:13Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"On Mon, Sep 08, 2008 at 02:06:02PM -0500, Brandon Casey wrote:\n[...]\n> I was just encountering this myself.\n> \n> sed can be fixed without the use of tr by replacing '\\n' with an explicit newline like:\n> \n> sed -e 's/deerit./&\\\n> \\\n> \\\n> \\\n> /' -e \"s/locavit,/locavit;/\" < new6.txt > new8.txt\n> \n> Of course it doesn't fit on one line though.\n\nI don't think replacing 2 lines with 10 is a big win (not counting a\npossible comment explaining why it's necessary).  I'd rather replaced\nthe thing with a Perl one-liner though, but that seems a bit frowned\nupon, correct?\n\nArjen\n\n-- \nArjen Laarhoven\n\nThe presence of those seeking the truth is infinitely to be preferred to \nthose who think they've found it.\n                                -- Terry Pratchett, \"Monstrous Regiment\"\n"},{"id":"90127","messageId":"7vej3ufnh3.fsf@gitster.siamese.dyndns.org","threadId":"15433","inReplyTo":"20080908192313.GB4148@regex.yaph.org","subject":"Re: [PATCH] t6023-merge-file: Work around non-portable sed usage","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-08T19:26:32Z","receivedAt":"2008-09-08T19:26:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"arjen@yaph.org (Arjen Laarhoven) writes:\n\n> On Mon, Sep 08, 2008 at 02:06:02PM -0500, Brandon Casey wrote:\n> [...]\n>> I was just encountering this myself.\n>> \n>> sed can be fixed without the use of tr by replacing '\\n' with an explicit newline like:\n>> \n>> sed -e 's/deerit./&\\\n>> \\\n>> \\\n>> \\\n>> /' -e \"s/locavit,/locavit;/\" < new6.txt > new8.txt\n>> \n>> Of course it doesn't fit on one line though.\n>\n> I don't think replacing 2 lines with 10 is a big win (not counting a\n> possible comment explaining why it's necessary).  I'd rather replaced\n> the thing with a Perl one-liner though, but that seems a bit frowned\n> upon, correct?\n\nPerl one-liner is Ok, so are pregenerated test vectors in separate\ndirectory (i.e. ship with t/t6023/new6.txt file and refer to it from the\ntest as \"$TEST_DIRECTORY/t6023/new6.txt\"), but I think your original patch\nto use % is perfectly fine for this one.\n"}]}