@matheusbsbs / matheus-bagliano / commits / a8d8173e6c
Fork 0

Add tests for extra headers in format-patch

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Barkalow committed Feb 19, 2008 at 02:40 UTC a8d8173e6c7ff85627377389e40844ec71206f5e
1 file changed +34
t/t4014-format-patch.sh
+34
@@ -88,6 +88,40 @@ test_expect_success 'replay did not screw up the log message' '
88
89 '
90
91 +test_expect_success 'extra headers' '
92 +
93 + git config format.headers "To: R. E. Cipient <rcipient@example.com>
94 +" &&
95 + git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
96 +" &&
97 + git format-patch --stdout master..side > patch2 &&
98 + sed -e "/^$/Q" patch2 > hdrs2 &&
99 + grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
100 + grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
101 +
102 +'
103 +
104 +test_expect_failure 'extra headers without newlines' '
105 +
106 + git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
107 + git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
108 + git format-patch --stdout master..side >patch3 &&
109 + sed -e "/^$/Q" patch3 > hdrs3 &&
110 + grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
111 + grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
112 +
113 +'
114 +
115 +test_expect_failure 'extra headers with multiple To:s' '
116 +
117 + git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
118 + git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
119 + git format-patch --stdout master..side > patch4 &&
120 + sed -e "/^$/Q" patch4 > hdrs4 &&
121 + grep "^To: R. E. Cipient <rcipient@example.com>,$" hdrs4 &&
122 + grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
123 +'
124 +
125 test_expect_success 'multiple files' '
126
127 rm -rf patches/ &&