From: Junio C Hamano Date: Mon, 23 Nov 2009 18:27:32 GMT Subject: Re: [PATCH] t/gitweb-lib: Split HTTP response with non-GNU sed Message-ID: <7vocmtyu3v.fsf@alter.siamese.dyndns.org> In-Reply-To: <1258997622-62403-1-git-send-email-brian@gernhardtsoftware.com> Brian Gernhardt writes: > Recognizing \r in a regex is something GNU sed will do, but other sed > implementation's won't. (Found with BSD sed on OS X.) So use a > literal carriage return instead. I'd actually prefer not having to deal with this issue. How about doing something like this instead? t/gitweb-lib.sh | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh index 32b841d..3121950 100644 --- a/t/gitweb-lib.sh +++ b/t/gitweb-lib.sh @@ -52,8 +52,18 @@ gitweb_run () { rm -f gitweb.log && perl -- "$SCRIPT_NAME" \ >gitweb.output 2>gitweb.log && - sed -e '/^\r$/q' gitweb.headers && - sed -e '1,/^\r$/d' gitweb.body && + perl -w -e ' + open O, ">gitweb.headers"; + while (<>) { + print O; + last if (/^\r$/ || /^$/); + } + open O, ">gitweb.body"; + while (<>) { + print O; + } + close O; + ' gitweb.output && if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi # gitweb.log is left for debugging