32
}
33
34
test_expect_success 'Extract patches' '
35
- patches=`git format-patch --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
35
+ patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
36
'
37
38
test_expect_success 'Send patches' '
39
- git send-email --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
39
+ git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
40
'
41
42
cat >expected <<\EOF
74
test_expect_success 'Show all headers' '
75
git send-email \
76
--dry-run \
77
+ --suppress-cc=sob \
78
--from="Example <from@example.com>" \
79
--to=to@example.com \
80
--cc=cc@example.com \
194
grep "Subject:.*Second" msgtxt2
195
'
196
196
-cat >expected-show-all-headers <<\EOF
197
+cat >expected-suppress-sob <<\EOF
198
0001-Second.patch
199
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
200
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
214
Result: OK
215
EOF
216
216
-test_expect_success 'sendemail.cc set' '
217
- git config sendemail.cc cc@example.com &&
217
+test_suppression () {
218
git send-email \
219
--dry-run \
220
+ --suppress-cc=$1 \
221
--from="Example <from@example.com>" \
222
--to=to@example.com \
223
--smtp-server relay.example.com \
225
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
226
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
227
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
227
- >actual-show-all-headers &&
228
- test_cmp expected-show-all-headers actual-show-all-headers
228
+ >actual-suppress-$1 &&
229
+ test_cmp expected-suppress-$1 actual-suppress-$1
230
+}
231
+
232
+test_expect_success 'sendemail.cc set' '
233
+ git config sendemail.cc cc@example.com &&
234
+ test_suppression sob
235
'
236
231
-cat >expected-show-all-headers <<\EOF
237
+cat >expected-suppress-sob <<\EOF
238
0001-Second.patch
239
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
240
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
256
257
test_expect_success 'sendemail.cc unset' '
258
git config --unset sendemail.cc &&
253
- git send-email \
254
- --dry-run \
255
- --from="Example <from@example.com>" \
256
- --to=to@example.com \
257
- --smtp-server relay.example.com \
258
- $patches |
259
- sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
260
- -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
261
- -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
262
- >actual-show-all-headers &&
263
- test_cmp expected-show-all-headers actual-show-all-headers
259
+ test_suppression sob
260
+'
261
+
262
+cat >expected-suppress-all <<\EOF
263
+0001-Second.patch
264
+Dry-OK. Log says:
265
+Server: relay.example.com
266
+MAIL FROM:<from@example.com>
267
+RCPT TO:<to@example.com>
268
+From: Example <from@example.com>
269
+To: to@example.com
270
+Subject: [PATCH 1/1] Second.
271
+Date: DATE-STRING
272
+Message-Id: MESSAGE-ID-STRING
273
+X-Mailer: X-MAILER-STRING
274
+
275
+Result: OK
276
+EOF
277
+
278
+test_expect_success '--suppress-cc=all' '
279
+ test_suppression all
280
+'
281
+
282
+cat >expected-suppress-body <<\EOF
283
+0001-Second.patch
284
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
285
+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
286
+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
287
+Dry-OK. Log says:
288
+Server: relay.example.com
289
+MAIL FROM:<from@example.com>
290
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
291
+From: Example <from@example.com>
292
+To: to@example.com
293
+Cc: A <author@example.com>, One <one@example.com>, two@example.com
294
+Subject: [PATCH 1/1] Second.
295
+Date: DATE-STRING
296
+Message-Id: MESSAGE-ID-STRING
297
+X-Mailer: X-MAILER-STRING
298
+
299
+Result: OK
300
+EOF
301
+
302
+test_expect_success '--suppress-cc=body' '
303
+ test_suppression body
304
+'
305
+
306
+cat >expected-suppress-sob <<\EOF
307
+0001-Second.patch
308
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
309
+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
310
+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
311
+Dry-OK. Log says:
312
+Server: relay.example.com
313
+MAIL FROM:<from@example.com>
314
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
315
+From: Example <from@example.com>
316
+To: to@example.com
317
+Cc: A <author@example.com>, One <one@example.com>, two@example.com
318
+Subject: [PATCH 1/1] Second.
319
+Date: DATE-STRING
320
+Message-Id: MESSAGE-ID-STRING
321
+X-Mailer: X-MAILER-STRING
322
+
323
+Result: OK
324
+EOF
325
+
326
+test_expect_success '--suppress-cc=sob' '
327
+ test_suppression sob
328
+'
329
+
330
+cat >expected-suppress-bodycc <<\EOF
331
+0001-Second.patch
332
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
333
+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
334
+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
335
+(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
336
+Dry-OK. Log says:
337
+Server: relay.example.com
338
+MAIL FROM:<from@example.com>
339
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>
340
+From: Example <from@example.com>
341
+To: to@example.com
342
+Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>
343
+Subject: [PATCH 1/1] Second.
344
+Date: DATE-STRING
345
+Message-Id: MESSAGE-ID-STRING
346
+X-Mailer: X-MAILER-STRING
347
+
348
+Result: OK
349
+EOF
350
+
351
+test_expect_success '--suppress-cc=bodycc' '
352
+ test_suppression bodycc
353
+'
354
+
355
+cat >expected-suppress-cc <<\EOF
356
+0001-Second.patch
357
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
358
+(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
359
+Dry-OK. Log says:
360
+Server: relay.example.com
361
+MAIL FROM:<from@example.com>
362
+RCPT TO:<to@example.com>,<author@example.com>,<committer@example.com>
363
+From: Example <from@example.com>
364
+To: to@example.com
365
+Cc: A <author@example.com>, C O Mitter <committer@example.com>
366
+Subject: [PATCH 1/1] Second.
367
+Date: DATE-STRING
368
+Message-Id: MESSAGE-ID-STRING
369
+X-Mailer: X-MAILER-STRING
370
+
371
+Result: OK
372
+EOF
373
+
374
+test_expect_success '--suppress-cc=cc' '
375
+ test_suppression cc
376
'
377
378
test_expect_success '--compose adds MIME for utf8 body' '