t7502: clean up fake_editor tests

Using write_script saves us a few lines of code, and means we consistently use $SHELL_PATH. We can also drop the setting of the $pwd variable from $(pwd). In the first instance, there is no reason to use it (we can just use $(pwd) directly two lines later, since we are interpolating the here-document). In the second instance, it is totally pointless and probably just a cut-and-paste from the first instance. Finally, we can use a non-interpolating here document for the final script, which saves some quoting. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 26, 2012 at 16:27 UTC a9ebc43bd07e219922d1dab17df319f1cae5d600
1 file changed +7 -13
t/t7502-commit.sh
+7 -13
@@ -266,13 +266,10 @@ test_expect_success 'committer is automatic' '
266 test_i18ncmp expect actual
267 '
268
269 -pwd=`pwd`
270 -cat >> .git/FAKE_EDITOR << EOF
271 -#! /bin/sh
272 -echo editor started > "$pwd/.git/result"
269 +write_script .git/FAKE_EDITOR <<EOF
270 +echo editor started > "$(pwd)/.git/result"
271 exit 0
272 EOF
275 -chmod +x .git/FAKE_EDITOR
273
274 test_expect_success 'do not fire editor in the presence of conflicts' '
275
@@ -300,9 +297,7 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
297 test "$(cat .git/result)" = "editor not started"
298 '
299
303 -pwd=`pwd`
304 -cat >.git/FAKE_EDITOR <<EOF
305 -#! $SHELL_PATH
300 +write_script .git/FAKE_EDITOR <<EOF
301 # kill -TERM command added below.
302 EOF
303
@@ -339,13 +334,12 @@ test_expect_success 'A single-liner subject with a token plus colon is not a foo
334
335 '
336
342 -cat >.git/FAKE_EDITOR <<EOF
343 -#!$SHELL_PATH
344 -mv "\$1" "\$1.orig"
337 +write_script .git/FAKE_EDITOR <<\EOF
338 +mv "$1" "$1.orig"
339 (
340 echo message
347 - cat "\$1.orig"
348 -) >"\$1"
341 + cat "$1.orig"
342 +) >"$1"
343 EOF
344
345 echo '## Custom template' >template