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

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

 



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@xxxxxxxx>
---

 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

--
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]