diff options
author | Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> | 2015-06-30 14:16:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-30 11:34:34 -0700 |
commit | d4cf11c2e948890c2daf27fba6727e3b814cfe3c (patch) | |
tree | 004d1a01c5be6f6422d928b3d8b5ceecf4e6b76d /t | |
parent | send-email: allow aliases in patch header and command script outputs (diff) | |
download | tgif-d4cf11c2e948890c2daf27fba6727e3b814cfe3c.tar.xz |
t9001-send-email: refactor header variable fields replacement
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
Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t9001-send-email.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 062c703b28..806f06631d 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,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 \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example <from@example.com>" \ --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"} } |