mirror of
https://github.com/git/git.git
synced 2024-10-31 22:37:54 +01:00
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>
This commit is contained in:
parent
f6f79e5ee3
commit
d4cf11c2e9
1 changed files with 7 additions and 4 deletions
|
@ -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"}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue