From: Remi Lespinet Date: Mon, 01 Jun 2015 14:14:01 GMT Subject: [PATCH 1/2] t9001-send-email: create a function replacing variable fields Message-ID: <1433168042-28269-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr> Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING This is a preparatory for the next commit which uses this function Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..71968ee 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -519,6 +519,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -526,10 +532,7 @@ test_suppression () { --from="Example " \ --to=to@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1