aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorBrian Gernhardt <brian@gernhardtsoftware.com>2009-11-23 12:33:42 -0500
committerJunio C Hamano <gitster@pobox.com>2009-11-23 22:26:58 -0800
commitf74a83fcf04c50e8358c8fb493539af13f9b9aa5 (patch)
treef9b928c77685ada6f104bbc148533358dd48da93 /t
parentb629275fd02aa07c2630d1a8c8a14011ff164043 (diff)
downloadgit-f74a83fcf04c50e8358c8fb493539af13f9b9aa5.tar.gz
git-f74a83fcf04c50e8358c8fb493539af13f9b9aa5.tar.xz
t/gitweb-lib: Split HTTP response with non-GNU sed
Recognizing \r in a regex is something GNU sed will do, but other sed implementation's won't (e.g. BSD sed on OS X). Instead of two sed invocations, use a single Perl script to split output into headers and body. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/gitweb-lib.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 32b841dd2..76d8b7b80 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.output >gitweb.headers &&
- sed -e '1,/^\r$/d' <gitweb.output >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