git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Walton <bwalton@artsci.utoronto.ca>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Ben Walton <bwalton@artsci.utoronto.ca>
Subject: [PATCH] Use perl instead of sed for t8006-blame-textconv test
Date: Mon,  9 Jan 2012 21:47:33 -0500	[thread overview]
Message-ID: <1326163653-26565-2-git-send-email-bwalton@artsci.utoronto.ca> (raw)
In-Reply-To: <1326163653-26565-1-git-send-email-bwalton@artsci.utoronto.ca>

In test 'blame --textconv with local changes' of t8006-blame-textconv,
using /usr/xpg4/bin/sed (as set by SANE_TOOL_PATH), an additional
newline was added to the output from the 'helper' script.

This was noted by sed with a message such as:
sed: Missing newline at end of file zero.bin.

Sed then exits with status 2 causing the helper script to also exit
with status 2.

In turn, this was triggering a fatal error from git blame:
fatal: unable to read files to diff

To work around this difference in sed behaviour, use perl -p instead
of sed -e as it exits cleanly and does not insert the additional
newline.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 t/t8006-blame-textconv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index 4ee42f1..c3c22f7 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -10,7 +10,7 @@ find_blame() {
 cat >helper <<'EOF'
 #!/bin/sh
 grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; }
-sed 's/^bin: /converted: /' "$1"
+perl -p -e 's/^bin: /converted: /' "$1"
 EOF
 chmod +x helper
 
-- 
1.7.8.2

  reply	other threads:[~2012-01-10  2:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-31 13:44 [PATCH] Work around sed portability issue in t8006-blame-textconv Ben Walton
2012-01-03 19:05 ` Junio C Hamano
2012-01-06 22:53   ` Junio C Hamano
2012-01-09  3:40     ` Ben Walton
2012-01-10  2:47   ` [PATCH 0/1] Re-roll of the test fix for sed on solaris Ben Walton
2012-01-10  2:47     ` Ben Walton [this message]
2012-01-10  4:46     ` Junio C Hamano

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=1326163653-26565-2-git-send-email-bwalton@artsci.utoronto.ca \
    --to=bwalton@artsci.utoronto.ca \
    --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).