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>
This commit is contained in:

committed by
Junio C Hamano

parent
18502e3606
commit
a9ebc43bd0
@ -266,13 +266,10 @@ test_expect_success 'committer is automatic' '
|
|||||||
test_i18ncmp expect actual
|
test_i18ncmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
pwd=`pwd`
|
write_script .git/FAKE_EDITOR <<EOF
|
||||||
cat >> .git/FAKE_EDITOR << EOF
|
echo editor started > "$(pwd)/.git/result"
|
||||||
#! /bin/sh
|
|
||||||
echo editor started > "$pwd/.git/result"
|
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
chmod +x .git/FAKE_EDITOR
|
|
||||||
|
|
||||||
test_expect_success 'do not fire editor in the presence of conflicts' '
|
test_expect_success 'do not fire editor in the presence of conflicts' '
|
||||||
|
|
||||||
@ -300,9 +297,7 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
|
|||||||
test "$(cat .git/result)" = "editor not started"
|
test "$(cat .git/result)" = "editor not started"
|
||||||
'
|
'
|
||||||
|
|
||||||
pwd=`pwd`
|
write_script .git/FAKE_EDITOR <<EOF
|
||||||
cat >.git/FAKE_EDITOR <<EOF
|
|
||||||
#! $SHELL_PATH
|
|
||||||
# kill -TERM command added below.
|
# kill -TERM command added below.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -339,13 +334,12 @@ test_expect_success 'A single-liner subject with a token plus colon is not a foo
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >.git/FAKE_EDITOR <<EOF
|
write_script .git/FAKE_EDITOR <<\EOF
|
||||||
#!$SHELL_PATH
|
mv "$1" "$1.orig"
|
||||||
mv "\$1" "\$1.orig"
|
|
||||||
(
|
(
|
||||||
echo message
|
echo message
|
||||||
cat "\$1.orig"
|
cat "$1.orig"
|
||||||
) >"\$1"
|
) >"$1"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo '## Custom template' >template
|
echo '## Custom template' >template
|
||||||
|
Reference in New Issue
Block a user