git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] t9001-send-email: create a function replacing variable fields

From
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Date
Jun 1, 2015, 14:14 UTC
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 <remi.lespinet@ensimag.grenoble-inp.fr>
---
 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 <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"}
 }
-- 
1.9.1
Next: Remi Lespinet
Message 1 of 7 in “t9001-send-email: create a function replacing variable fields”
  1. 1/2 t9001-send-email: create a function replacing variable fieldsRemi Lespinet, Jun 1, 2015
  2. 2/2 send-email: allow multiple emails using --cc, --to and --bccRemi Lespinet, Jun 1, 2015
  3. Matthieu MoyJun 1, 2015
  4. Junio C HamanoJun 1, 2015
  5. Junio C HamanoJun 1, 2015
  6. Rémi LespinetJun 2, 2015
  7. Junio C HamanoJun 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.