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

[PATCH 1/4] Add tests for extra headers in format-patch

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Feb 19, 2008, 07:40 UTC
Message-ID
<alpine.LNX.1.00.0802190239380.5816@iabervon.org>

Presently, it works with each header ending with a newline, but not without the newlines.

Also add a test to see that multiple "To:" headers get combined.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 t/t4014-format-patch.sh |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index ac78752..28ab7b9 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -88,6 +88,40 @@ test_expect_success 'replay did not screw up the log message' '
 
 '
 
+test_expect_success 'extra headers' '
+
+	git config format.headers "To: R. E. Cipient <rcipient@example.com>
+" &&
+	git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
+" &&
+	git format-patch --stdout master..side > patch2 &&
+	sed -e "/^$/Q" patch2 > hdrs2 &&
+	grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
+	grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
+	
+'
+
+test_expect_failure 'extra headers without newlines' '
+
+	git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
+	git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
+	git format-patch --stdout master..side >patch3 &&
+	sed -e "/^$/Q" patch3 > hdrs3 &&
+	grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
+	grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
+	
+'
+
+test_expect_failure 'extra headers with multiple To:s' '
+
+	git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
+	git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
+	git format-patch --stdout master..side > patch4 &&
+	sed -e "/^$/Q" patch4 > hdrs4 &&
+	grep "^To: R. E. Cipient <rcipient@example.com>,$" hdrs4 &&
+	grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
+'
+
 test_expect_success 'multiple files' '
 
 	rm -rf patches/ &&
-- 
1.5.4.1.192.g8ea3a
Message 1 of 1 in “Add tests for extra headers in format-patch”
  1. 1/4 Add tests for extra headers in format-patchDaniel Barkalow, Feb 19, 2008

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.