t5406: use write_script() instead of birthing shell script manually

Take advantage of write_script() to abstract-away details of shell
script creation, thus allowing the reader to focus on script content.
Readability benefits, particularly in this case, since the script body
was buried in a noisy one-liner subshell responsible for emitting
boilerplate and body.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Sunshine 2018-07-01 20:23:47 -04:00 committed by Junio C Hamano
parent fbd6ef273e
commit fb23bd7af2

View File

@ -6,8 +6,9 @@ test_description='remote push rejects are reported by client'
test_expect_success 'setup' ' test_expect_success 'setup' '
mkdir .git/hooks && mkdir .git/hooks &&
(echo "#!/bin/sh" ; echo "exit 1") >.git/hooks/update && write_script .git/hooks/update <<-\EOF &&
chmod +x .git/hooks/update && exit 1
EOF
echo 1 >file && echo 1 >file &&
git add file && git add file &&
git commit -m 1 && git commit -m 1 &&