git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arjen Laarhoven <arjen@yaph.org>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH] annotate.sh: Fix failing test on OS X
Date: Wed,  4 May 2011 15:36:21 +0200	[thread overview]
Message-ID: <1304516181-92364-1-git-send-email-arjen@yaph.org> (raw)

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

                 reply	other threads:[~2011-05-04 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304516181-92364-1-git-send-email-arjen@yaph.org \
    --to=arjen@yaph.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).