t9001: use existing helper in send-email test

Use the wrapper function around the sed statement like everywhere else in the test. Unfortunately the wrapper function is defined pretty late. Move the wrapper to the top of the test file, so future users have it available right away. Signed-off-by: Christian Ludwig <chrissicool@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Ludwig committed Jan 12, 2018 at 11:37 UTC ec3b4b06f88e612f02dc7b289b7540389326b6f9
1 file changed +7 -10
t/t9001-send-email.sh
+7 -10
@@ -6,6 +6,12 @@ test_description='git send-email'
6 # May be altered later in the test
7 PREREQ="PERL"
8
9 +replace_variable_fields () {
10 + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
11 + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
12 + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
13 +}
14 +
15 test_expect_success $PREREQ 'prepare reference tree' '
16 echo "1A quick brown fox jumps over the" >file &&
17 echo "lazy dog" >>file &&
@@ -293,10 +299,7 @@ test_expect_success $PREREQ 'Show all headers' '
299 --bcc=bcc@example.com \
300 --in-reply-to="<unique-message-id@example.com>" \
301 --smtp-server relay.example.com \
296 - $patches |
297 - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
298 - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
299 - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
302 + $patches | replace_variable_fields \
303 >actual-show-all-headers &&
304 test_cmp expected-show-all-headers actual-show-all-headers
305 '
@@ -551,12 +554,6 @@ Result: OK
554 EOF
555 "
556
554 -replace_variable_fields () {
555 - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
556 - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
557 - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
558 -}
559 -
557 test_suppression () {
558 git send-email \
559 --dry-run \