t0300: use write_script helper

t0300 creates some helper shell scripts, and marks them with "!/bin/sh". Even though the scripts are fairly simple, they can fail on broken shells (specifically, Solaris /bin/sh will persist a temporary assignment to IFS in a "read" command). Rather than work around the problem for Solaris /bin/sh, using write_script will make sure we point to a known-good shell that the user has given us. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 4, 2012 at 01:30 UTC 3d9f5b674fb53cc931e0f676f1599050bd69f696
1 file changed +2 -6
t/t0300-credentials.sh
+2 -6
@@ -14,22 +14,18 @@ test_expect_success 'setup helper scripts' '
14 done
15 EOF
16
17 - cat >git-credential-useless <<-\EOF &&
18 - #!/bin/sh
17 + write_script git-credential-useless <<-\EOF &&
18 . ./dump
19 exit 0
20 EOF
22 - chmod +x git-credential-useless &&
21
24 - cat >git-credential-verbatim <<-\EOF &&
25 - #!/bin/sh
22 + write_script git-credential-verbatim <<-\EOF &&
23 user=$1; shift
24 pass=$1; shift
25 . ./dump
26 test -z "$user" || echo username=$user
27 test -z "$pass" || echo password=$pass
28 EOF
32 - chmod +x git-credential-verbatim &&
29
30 PATH="$PWD:$PATH"
31 '