Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t9001-send-email: refactor header variable fields replacement
author
Remi Lespinet
<remi.lespinet@ensimag.grenoble-inp.fr>
Tue, 30 Jun 2015 12:16:44 +0000
(14:16 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 30 Jun 2015 18:34:34 +0000
(11:34 -0700)
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>
t/t9001-send-email.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f6f79e5
)
diff --git
a/t/t9001-send-email.sh
b/t/t9001-send-email.sh
index 062c703b28b7ae5cec1e64cc4477a8014423d5a9..806f06631d10cb50fe2eee2d7faadc01df719083 100755
(executable)
--- a/
t/t9001-send-email.sh
+++ b/
t/t9001-send-email.sh
@@
-522,6
+522,12
@@
Result: OK
EOF
"
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 \
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 \
--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"}
}
>actual-suppress-$1${2+"-$2"} &&
test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
}