@@ -14,17 +14,19 @@ test_expect_success $PREREQ 'prepare reference tree' '
14
14
'
15
15
16
16
test_expect_success $PREREQ ' Setup helper tool' '
17
- (echo "#!$SHELL_PATH"
18
- echo shift
19
- echo output=1
20
- echo "while test -f commandline\$output; do output=\$((\$output+1)); done"
21
- echo for a
22
- echo do
23
- echo " echo \"!\$a!\""
24
- echo "done >commandline\$output"
25
- echo "cat > msgtxt\$output"
26
- ) >fake.sendmail &&
27
- chmod +x ./fake.sendmail &&
17
+ write_script fake.sendmail <<-\EOF &&
18
+ shift
19
+ output=1
20
+ while test -f commandline$output
21
+ do
22
+ output=$(($output+1))
23
+ done
24
+ for a
25
+ do
26
+ echo "!$a!"
27
+ done >commandline$output
28
+ cat >"msgtxt$output"
29
+ EOF
28
30
git add fake.sendmail &&
29
31
GIT_AUTHOR_NAME="A" git commit -a -m "Second."
30
32
'
@@ -307,11 +309,9 @@ test_expect_success $PREREQ 'tocmd works' '
307
309
clean_fake_sendmail &&
308
310
cp $patches tocmd.patch &&
309
311
echo [email protected] >>tocmd.patch &&
310
- {
311
- echo "#!$SHELL_PATH"
312
- echo sed -n -e s/^tocmd--//p \"\$1\"
313
- } > tocmd-sed &&
314
- chmod +x tocmd-sed &&
312
+ write_script tocmd-sed <<-\EOF &&
313
+ sed -n -e "s/^tocmd--//p" "$1"
314
+ EOF
315
315
git send-email \
316
316
--from="Example <[email protected] >" \
317
317
--to-cmd=./tocmd-sed \
@@ -325,11 +325,9 @@ test_expect_success $PREREQ 'cccmd works' '
325
325
clean_fake_sendmail &&
326
326
cp $patches cccmd.patch &&
327
327
echo "cccmd-- [email protected] " >>cccmd.patch &&
328
- {
329
- echo "#!$SHELL_PATH"
330
- echo sed -n -e s/^cccmd--//p \"\$1\"
331
- } > cccmd-sed &&
332
- chmod +x cccmd-sed &&
328
+ write_script cccmd-sed <<-\EOF &&
329
+ sed -n -e "s/^cccmd--//p" "$1"
330
+ EOF
333
331
git send-email \
334
332
--from="Example <[email protected] >" \
335
333
@@ -459,10 +457,9 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
459
457
'
460
458
461
459
test_expect_success $PREREQ ' setup fake editor' '
462
- (echo "#!$SHELL_PATH" &&
463
- echo "echo fake edit >>\"\$1\""
464
- ) >fake-editor &&
465
- chmod +x fake-editor
460
+ write_script fake-editor <<-\EOF
461
+ echo fake edit >>"$1"
462
+ EOF
466
463
'
467
464
468
465
test_set_editor " $( pwd) /fake-editor"
598
595
"
599
596
600
597
test_expect_success $PREREQ ' sendemail.cccmd' '
601
- echo echo [email protected] > cccmd &&
602
- chmod +x cccmd &&
598
+ write_script cccmd <<-\EOF &&
599
+
600
+ EOF
603
601
git config sendemail.cccmd ./cccmd &&
604
602
test_suppression cccmd
605
603
'
@@ -891,10 +889,9 @@ test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
891
889
892
890
test_expect_success $PREREQ ' --compose adds MIME for utf8 body' '
893
891
clean_fake_sendmail &&
894
- (echo "#!$SHELL_PATH" &&
895
- echo "echo utf8 body: àéìöú >>\"\$1\""
896
- ) >fake-editor-utf8 &&
897
- chmod +x fake-editor-utf8 &&
892
+ write_script fake-editor-utf8 <<-\EOF &&
893
+ echo "utf8 body: àéìöú" >>"$1"
894
+ EOF
898
895
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
899
896
git send-email \
900
897
--compose --subject foo \
@@ -908,15 +905,16 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
908
905
909
906
test_expect_success $PREREQ ' --compose respects user mime type' '
910
907
clean_fake_sendmail &&
911
- (echo "#!$SHELL_PATH" &&
912
- echo "(echo MIME-Version: 1.0"
913
- echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
914
- echo " echo Content-Transfer-Encoding: 8bit"
915
- echo " echo Subject: foo"
916
- echo " echo "
917
- echo " echo utf8 body: àéìöú) >\"\$1\""
918
- ) >fake-editor-utf8-mime &&
919
- chmod +x fake-editor-utf8-mime &&
908
+ write_script fake-editor-utf8-mime <<-\EOF &&
909
+ cat >"$1" <<-\EOM
910
+ MIME-Version: 1.0
911
+ Content-Type: text/plain; charset=iso-8859-1
912
+ Content-Transfer-Encoding: 8bit
913
+ Subject: foo
914
+
915
+ utf8 body: àéìöú
916
+ EOM
917
+ EOF
920
918
GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
921
919
git send-email \
922
920
--compose --subject foo \
@@ -972,10 +970,9 @@ test_expect_success $PREREQ 'utf8 sender is not duplicated' '
972
970
test_expect_success $PREREQ ' sendemail.composeencoding works' '
973
971
clean_fake_sendmail &&
974
972
git config sendemail.composeencoding iso-8859-1 &&
975
- (echo "#!$SHELL_PATH" &&
976
- echo "echo utf8 body: àéìöú >>\"\$1\""
977
- ) >fake-editor-utf8 &&
978
- chmod +x fake-editor-utf8 &&
973
+ write_script fake-editor-utf8 <<-\EOF &&
974
+ echo "utf8 body: àéìöú" >>"$1"
975
+ EOF
979
976
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
980
977
git send-email \
981
978
--compose --subject foo \
@@ -989,10 +986,9 @@ test_expect_success $PREREQ 'sendemail.composeencoding works' '
989
986
990
987
test_expect_success $PREREQ ' --compose-encoding works' '
991
988
clean_fake_sendmail &&
992
- (echo "#!$SHELL_PATH" &&
993
- echo "echo utf8 body: àéìöú >>\"\$1\""
994
- ) >fake-editor-utf8 &&
995
- chmod +x fake-editor-utf8 &&
989
+ write_script fake-editor-utf8 <<-\EOF &&
990
+ echo "utf8 body: àéìöú" >>"$1"
991
+ EOF
996
992
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
997
993
git send-email \
998
994
--compose-encoding iso-8859-1 \
@@ -1008,10 +1004,9 @@ test_expect_success $PREREQ '--compose-encoding works' '
1008
1004
test_expect_success $PREREQ ' --compose-encoding overrides sendemail.composeencoding' '
1009
1005
clean_fake_sendmail &&
1010
1006
git config sendemail.composeencoding iso-8859-1 &&
1011
- (echo "#!$SHELL_PATH" &&
1012
- echo "echo utf8 body: àéìöú >>\"\$1\""
1013
- ) >fake-editor-utf8 &&
1014
- chmod +x fake-editor-utf8 &&
1007
+ write_script fake-editor-utf8 <<-\EOF &&
1008
+ echo "utf8 body: àéìöú" >>"$1"
1009
+ EOF
1015
1010
GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
1016
1011
git send-email \
1017
1012
--compose-encoding iso-8859-2 \
0 commit comments