{"thread":{"id":"27250","subject":"[PATCH] annotate.sh: Fix failing test on OS X","startedAt":"2011-05-04T13:36:21Z","lastAt":"2011-05-04T13:36:21Z","messageCount":1,"participants":["Arjen Laarhoven"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"167017","messageId":"1304516181-92364-1-git-send-email-arjen@yaph.org","threadId":"27250","inReplyTo":null,"subject":"[PATCH] annotate.sh: Fix failing test on OS X","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2011-05-04T13:36:21Z","receivedAt":"2011-05-04T13:36:21Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"Commit 9b01f0038b63ccdf697b2387f4fcd4b03bd249d5 ('blame: tolerate bogus\ne-mail addresses a bit better') introduced a test for obfuscated email\naddresses, but it fails on OS X and probably other platforms which don't\nuse GNU sed.  The test breaks because non-GNU seds append a newline to\nevery line of the file, including the last one, even if it didn't have\none before editing.  GNU sed is smart about this (if the last line of\nthe file doesn't have newline, it is omitted when writing the output).\n\nAlso, the text after the sed insert command is expected to start on the\nnext line after a backslash.  GNU sed apparently also understands text\nright after the 'i'nsert command.\n\nThe fix uses a trick used earlier in the script, which is to remove the\nline completely and add it again without a newline using echo and tr.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n\n t/annotate-tests.sh |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/t/annotate-tests.sh b/t/annotate-tests.sh\nindex abb1885..a4c6146 100644\n--- a/t/annotate-tests.sh\n+++ b/t/annotate-tests.sh\n@@ -127,7 +127,9 @@ test_expect_success \\\n \n test_expect_success \\\n     'an obfuscated email added' \\\n-    'sed -e \"1i No robots allowed\" < file > file.new &&\n+    'sed -e \"1i\\\\\n+No robots allowed\" -e \"/^incomplete/d\" < file > file.new &&\n+     echo \"incomplete\" | tr -d \"\\\\012\" >>file.new &&\n      mv file.new file &&\n      GIT_AUTHOR_NAME=\"E\" GIT_AUTHOR_EMAIL=\"E at test dot git\" git commit -a -m \"norobots\"'\n \n-- \n1.7.5.278.g5fde9\n"}]}