@@ -110,73 +110,107 @@ test_expect_success 'replay did not screw up the log message' '
110110
111111test_expect_success ' extra headers' '
112112
113- git config format.headers "To: R. E. Cipient <rcipient@example.com>
113+ git config format.headers "To: R E Cipient <rcipient@example.com>
114114" &&
115- git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
115+ git config --add format.headers "Cc: S E Cipient <scipient@example.com>
116116" &&
117117 git format-patch --stdout master..side > patch2 &&
118118 sed -e "/^\$/q" patch2 > hdrs2 &&
119- grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs2 &&
120- grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs2
119+ grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 &&
120+ grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2
121121
122122'
123123
124124test_expect_success ' extra headers without newlines' '
125125
126- git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
127- git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
126+ git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" &&
127+ git config --add format.headers "Cc: S E Cipient <scipient@example.com>" &&
128128 git format-patch --stdout master..side >patch3 &&
129129 sed -e "/^\$/q" patch3 > hdrs3 &&
130- grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs3 &&
131- grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs3
130+ grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 &&
131+ grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3
132132
133133'
134134
135135test_expect_success ' extra headers with multiple To:s' '
136136
137- git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
138- git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
137+ git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" &&
138+ git config --add format.headers "To: S E Cipient <scipient@example.com>" &&
139139 git format-patch --stdout master..side > patch4 &&
140140 sed -e "/^\$/q" patch4 > hdrs4 &&
141- grep "^To: R. E. Cipient <rcipient@example.com>,\$" hdrs4 &&
142- grep "^ *S. E. Cipient <scipient@example.com>\$" hdrs4
141+ grep "^To: R E Cipient <rcipient@example.com>,\$" hdrs4 &&
142+ grep "^ *S E Cipient <scipient@example.com>\$" hdrs4
143143'
144144
145- test_expect_success ' additional command line cc' '
145+ test_expect_success ' additional command line cc (ascii) ' '
146146
147- git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
147+ git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
148+ git format-patch --cc="S E Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
149+ grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
150+ grep "^ *S E Cipient <scipient@example.com>\$" patch5
151+ '
152+
153+ test_expect_failure ' additional command line cc (rfc822)' '
154+
155+ git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
148156 git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
149- grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch5 &&
150- grep "^ *S. E. Cipient <scipient@example.com>\$" patch5
157+ grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
158+ grep "^ *" S. E. Cipient" <scipient@example.com>\$" patch5
151159'
152160
153161test_expect_success ' command line headers' '
154162
155163 git config --unset-all format.headers &&
156- git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
157- grep "^Cc: R. E. Cipient <rcipient@example.com>\$" patch6
164+ git format-patch --add-header="Cc: R E Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
165+ grep "^Cc: R E Cipient <rcipient@example.com>\$" patch6
158166'
159167
160168test_expect_success ' configuration headers and command line headers' '
161169
162- git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
163- git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
164- grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch7 &&
165- grep "^ *S. E. Cipient <scipient@example.com>\$" patch7
170+ git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
171+ git format-patch --add-header="Cc: S E Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
172+ grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch7 &&
173+ grep "^ *S E Cipient <scipient@example.com>\$" patch7
166174'
167175
168- test_expect_success ' command line To: header' '
176+ test_expect_success ' command line To: header (ascii) ' '
169177
170178 git config --unset-all format.headers &&
179+ git format-patch --to="R E Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
180+ grep "^To: R E Cipient <rcipient@example.com>\$" patch8
181+ '
182+
183+ test_expect_failure ' command line To: header (rfc822)' '
184+
171185 git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
172- grep "^To: R. E. Cipient <rcipient@example.com>\$" patch8
186+ grep "^To: "R. E. Cipient" <rcipient@example.com>\$" patch8
187+ '
188+
189+ test_expect_failure ' command line To: header (rfc2047)' '
190+
191+ git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
192+ grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch8
173193'
174194
175- test_expect_success ' configuration To: header' '
195+ test_expect_success ' configuration To: header (ascii)' '
196+
197+ git config format.to "R E Cipient <rcipient@example.com>" &&
198+ git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
199+ grep "^To: R E Cipient <rcipient@example.com>\$" patch9
200+ '
201+
202+ test_expect_failure ' configuration To: header (rfc822)' '
176203
177204 git config format.to "R. E. Cipient <rcipient@example.com>" &&
178205 git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
179- grep "^To: R. E. Cipient <rcipient@example.com>\$" patch9
206+ grep "^To: "R. E. Cipient" <rcipient@example.com>\$" patch9
207+ '
208+
209+ test_expect_failure ' configuration To: header (rfc2047)' '
210+
211+ git config format.to "R Ä Cipient <rcipient@example.com>" &&
212+ git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
213+ grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch9
180214'
181215
182216# check_patch <patch>: Verify that <patch> looks like a half-sane
@@ -190,11 +224,11 @@ check_patch () {
190224test_expect_success ' --no-to overrides config.to' '
191225
192226 git config --replace-all format.to \
193- "R. E. Cipient <rcipient@example.com>" &&
227+ "R E Cipient <rcipient@example.com>" &&
194228 git format-patch --no-to --stdout master..side |
195229 sed -e "/^\$/q" >patch10 &&
196230 check_patch patch10 &&
197- ! grep "^To: R. E. Cipient <rcipient@example.com>\$" patch10
231+ ! grep "^To: R E Cipient <rcipient@example.com>\$" patch10
198232'
199233
200234test_expect_success ' --no-to and --to replaces config.to' '
@@ -212,21 +246,21 @@ test_expect_success '--no-to and --to replaces config.to' '
212246test_expect_success ' --no-cc overrides config.cc' '
213247
214248 git config --replace-all format.cc \
215- "C. E. Cipient <rcipient@example.com>" &&
249+ "C E Cipient <rcipient@example.com>" &&
216250 git format-patch --no-cc --stdout master..side |
217251 sed -e "/^\$/q" >patch12 &&
218252 check_patch patch12 &&
219- ! grep "^Cc: C. E. Cipient <rcipient@example.com>\$" patch12
253+ ! grep "^Cc: C E Cipient <rcipient@example.com>\$" patch12
220254'
221255
222256test_expect_success ' --no-add-header overrides config.headers' '
223257
224258 git config --replace-all format.headers \
225- "Header1: B. E. Cipient <rcipient@example.com>" &&
259+ "Header1: B E Cipient <rcipient@example.com>" &&
226260 git format-patch --no-add-header --stdout master..side |
227261 sed -e "/^\$/q" >patch13 &&
228262 check_patch patch13 &&
229- ! grep "^Header1: B. E. Cipient <rcipient@example.com>\$" patch13
263+ ! grep "^Header1: B E Cipient <rcipient@example.com>\$" patch13
230264'
231265
232266test_expect_success ' multiple files' '
0 commit comments