t9001: style modernisation phase #3
Use write_script. The resulting patch makes it a lot easier to understand what the written script is doing. Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
03335f2295
commit
acd72b5636
|
@ -14,17 +14,19 @@ test_expect_success $PREREQ 'prepare reference tree' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ 'Setup helper tool' '
|
test_expect_success $PREREQ 'Setup helper tool' '
|
||||||
(echo "#!$SHELL_PATH"
|
write_script fake.sendmail <<-\EOF &&
|
||||||
echo shift
|
shift
|
||||||
echo output=1
|
output=1
|
||||||
echo "while test -f commandline\$output; do output=\$((\$output+1)); done"
|
while test -f commandline$output
|
||||||
echo for a
|
do
|
||||||
echo do
|
output=$(($output+1))
|
||||||
echo " echo \"!\$a!\""
|
done
|
||||||
echo "done >commandline\$output"
|
for a
|
||||||
echo "cat > msgtxt\$output"
|
do
|
||||||
) >fake.sendmail &&
|
echo "!$a!"
|
||||||
chmod +x ./fake.sendmail &&
|
done >commandline$output
|
||||||
|
cat >"msgtxt$output"
|
||||||
|
EOF
|
||||||
git add fake.sendmail &&
|
git add fake.sendmail &&
|
||||||
GIT_AUTHOR_NAME="A" git commit -a -m "Second."
|
GIT_AUTHOR_NAME="A" git commit -a -m "Second."
|
||||||
'
|
'
|
||||||
|
@ -307,11 +309,9 @@ test_expect_success $PREREQ 'tocmd works' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
cp $patches tocmd.patch &&
|
cp $patches tocmd.patch &&
|
||||||
echo tocmd--tocmd@example.com >>tocmd.patch &&
|
echo tocmd--tocmd@example.com >>tocmd.patch &&
|
||||||
{
|
write_script tocmd-sed <<-\EOF &&
|
||||||
echo "#!$SHELL_PATH"
|
sed -n -e "s/^tocmd--//p" "$1"
|
||||||
echo sed -n -e s/^tocmd--//p \"\$1\"
|
EOF
|
||||||
} > tocmd-sed &&
|
|
||||||
chmod +x tocmd-sed &&
|
|
||||||
git send-email \
|
git send-email \
|
||||||
--from="Example <nobody@example.com>" \
|
--from="Example <nobody@example.com>" \
|
||||||
--to-cmd=./tocmd-sed \
|
--to-cmd=./tocmd-sed \
|
||||||
|
@ -325,11 +325,9 @@ test_expect_success $PREREQ 'cccmd works' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
cp $patches cccmd.patch &&
|
cp $patches cccmd.patch &&
|
||||||
echo "cccmd-- cccmd@example.com" >>cccmd.patch &&
|
echo "cccmd-- cccmd@example.com" >>cccmd.patch &&
|
||||||
{
|
write_script cccmd-sed <<-\EOF &&
|
||||||
echo "#!$SHELL_PATH"
|
sed -n -e "s/^cccmd--//p" "$1"
|
||||||
echo sed -n -e s/^cccmd--//p \"\$1\"
|
EOF
|
||||||
} > cccmd-sed &&
|
|
||||||
chmod +x cccmd-sed &&
|
|
||||||
git send-email \
|
git send-email \
|
||||||
--from="Example <nobody@example.com>" \
|
--from="Example <nobody@example.com>" \
|
||||||
--to=nobody@example.com \
|
--to=nobody@example.com \
|
||||||
|
@ -459,10 +457,9 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ 'setup fake editor' '
|
test_expect_success $PREREQ 'setup fake editor' '
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor <<-\EOF
|
||||||
echo "echo fake edit >>\"\$1\""
|
echo fake edit >>"$1"
|
||||||
) >fake-editor &&
|
EOF
|
||||||
chmod +x fake-editor
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_set_editor "$(pwd)/fake-editor"
|
test_set_editor "$(pwd)/fake-editor"
|
||||||
|
@ -598,8 +595,9 @@ EOF
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success $PREREQ 'sendemail.cccmd' '
|
test_expect_success $PREREQ 'sendemail.cccmd' '
|
||||||
echo echo cc-cmd@example.com > cccmd &&
|
write_script cccmd <<-\EOF &&
|
||||||
chmod +x cccmd &&
|
echo cc-cmd@example.com
|
||||||
|
EOF
|
||||||
git config sendemail.cccmd ./cccmd &&
|
git config sendemail.cccmd ./cccmd &&
|
||||||
test_suppression cccmd
|
test_suppression cccmd
|
||||||
'
|
'
|
||||||
|
@ -891,10 +889,9 @@ test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
|
||||||
|
|
||||||
test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
|
test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor-utf8 <<-\EOF &&
|
||||||
echo "echo utf8 body: àéìöú >>\"\$1\""
|
echo "utf8 body: àéìöú" >>"$1"
|
||||||
) >fake-editor-utf8 &&
|
EOF
|
||||||
chmod +x fake-editor-utf8 &&
|
|
||||||
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
||||||
git send-email \
|
git send-email \
|
||||||
--compose --subject foo \
|
--compose --subject foo \
|
||||||
|
@ -908,15 +905,16 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
|
||||||
|
|
||||||
test_expect_success $PREREQ '--compose respects user mime type' '
|
test_expect_success $PREREQ '--compose respects user mime type' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor-utf8-mime <<-\EOF &&
|
||||||
echo "(echo MIME-Version: 1.0"
|
cat >"$1" <<-\EOM
|
||||||
echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
|
MIME-Version: 1.0
|
||||||
echo " echo Content-Transfer-Encoding: 8bit"
|
Content-Type: text/plain; charset=iso-8859-1
|
||||||
echo " echo Subject: foo"
|
Content-Transfer-Encoding: 8bit
|
||||||
echo " echo "
|
Subject: foo
|
||||||
echo " echo utf8 body: àéìöú) >\"\$1\""
|
|
||||||
) >fake-editor-utf8-mime &&
|
utf8 body: àéìöú
|
||||||
chmod +x fake-editor-utf8-mime &&
|
EOM
|
||||||
|
EOF
|
||||||
GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
|
GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
|
||||||
git send-email \
|
git send-email \
|
||||||
--compose --subject foo \
|
--compose --subject foo \
|
||||||
|
@ -972,10 +970,9 @@ test_expect_success $PREREQ 'utf8 sender is not duplicated' '
|
||||||
test_expect_success $PREREQ 'sendemail.composeencoding works' '
|
test_expect_success $PREREQ 'sendemail.composeencoding works' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
git config sendemail.composeencoding iso-8859-1 &&
|
git config sendemail.composeencoding iso-8859-1 &&
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor-utf8 <<-\EOF &&
|
||||||
echo "echo utf8 body: àéìöú >>\"\$1\""
|
echo "utf8 body: àéìöú" >>"$1"
|
||||||
) >fake-editor-utf8 &&
|
EOF
|
||||||
chmod +x fake-editor-utf8 &&
|
|
||||||
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
||||||
git send-email \
|
git send-email \
|
||||||
--compose --subject foo \
|
--compose --subject foo \
|
||||||
|
@ -989,10 +986,9 @@ test_expect_success $PREREQ 'sendemail.composeencoding works' '
|
||||||
|
|
||||||
test_expect_success $PREREQ '--compose-encoding works' '
|
test_expect_success $PREREQ '--compose-encoding works' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor-utf8 <<-\EOF &&
|
||||||
echo "echo utf8 body: àéìöú >>\"\$1\""
|
echo "utf8 body: àéìöú" >>"$1"
|
||||||
) >fake-editor-utf8 &&
|
EOF
|
||||||
chmod +x fake-editor-utf8 &&
|
|
||||||
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
||||||
git send-email \
|
git send-email \
|
||||||
--compose-encoding iso-8859-1 \
|
--compose-encoding iso-8859-1 \
|
||||||
|
@ -1008,10 +1004,9 @@ test_expect_success $PREREQ '--compose-encoding works' '
|
||||||
test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
|
test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
|
||||||
clean_fake_sendmail &&
|
clean_fake_sendmail &&
|
||||||
git config sendemail.composeencoding iso-8859-1 &&
|
git config sendemail.composeencoding iso-8859-1 &&
|
||||||
(echo "#!$SHELL_PATH" &&
|
write_script fake-editor-utf8 <<-\EOF &&
|
||||||
echo "echo utf8 body: àéìöú >>\"\$1\""
|
echo "utf8 body: àéìöú" >>"$1"
|
||||||
) >fake-editor-utf8 &&
|
EOF
|
||||||
chmod +x fake-editor-utf8 &&
|
|
||||||
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
|
||||||
git send-email \
|
git send-email \
|
||||||
--compose-encoding iso-8859-2 \
|
--compose-encoding iso-8859-2 \
|
||||||
|
|
Loading…
Reference in New Issue