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

[PATCH] annotate.sh: Fix failing test on OS X

From
Arjen Laarhoven <arjen@yaph.org>
Date
May 4, 2011, 13:36 UTC
Message-ID
<1304516181-92364-1-git-send-email-arjen@yaph.org>

Commit 9b01f0038b63ccdf697b2387f4fcd4b03bd249d5 ('blame: tolerate bogus e-mail addresses a bit better') introduced a test for obfuscated email addresses, but it fails on OS X and probably other platforms which don't use GNU sed. The test breaks because non-GNU seds append a newline to every line of the file, including the last one, even if it didn't have one before editing. GNU sed is smart about this (if the last line of the file doesn't have newline, it is omitted when writing the output).

Also, the text after the sed insert command is expected to start on the next line after a backslash. GNU sed apparently also understands text right after the 'i'nsert command.

The fix uses a trick used earlier in the script, which is to remove the line completely and add it again without a newline using echo and tr.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
---
 t/annotate-tests.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index abb1885..a4c6146 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -127,7 +127,9 @@ test_expect_success \
 
 test_expect_success \
     'an obfuscated email added' \
-    'sed -e "1i No robots allowed" < file > file.new &&
+    'sed -e "1i\\
+No robots allowed" -e "/^incomplete/d" < file > file.new &&
+     echo "incomplete" | tr -d "\\012" >>file.new &&
      mv file.new file &&
      GIT_AUTHOR_NAME="E" GIT_AUTHOR_EMAIL="E at test dot git" git commit -a -m "norobots"'
 
-- 
1.7.5.278.g5fde9
Message 1 of 1 in “annotate.sh: Fix failing test on OS X”
  1. annotate.sh: Fix failing test on OS XArjen Laarhoven, May 4, 2011

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.