@@ -32,11 +32,11 @@ clean_fake_sendmail() {
32
32
}
33
33
34
34
test_expect_success ' Extract patches' '
35
- patches=`git format-patch --cc="One <[email protected] >" [email protected] -n HEAD^1`
35
+ patches=`git format-patch -s - -cc="One <[email protected] >" [email protected] -n HEAD^1`
36
36
'
37
37
38
38
test_expect_success ' Send patches' '
39
- git send-email --from="Example <[email protected] >" [email protected] --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
39
+ git send-email --suppress-cc=sob -- from="Example <[email protected] >" [email protected] --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
40
40
'
41
41
42
42
cat > expected << \EOF
74
74
test_expect_success ' Show all headers' '
75
75
git send-email \
76
76
--dry-run \
77
+ --suppress-cc=sob \
77
78
--from="Example <[email protected] >" \
78
79
79
80
@@ -193,7 +194,7 @@ test_expect_success 'second message is patch' '
193
194
grep "Subject:.*Second" msgtxt2
194
195
'
195
196
196
- cat > expected-show-all-headers << \EOF
197
+ cat > expected-suppress-sob << \EOF
197
198
0001-Second.patch
198
199
(mbox) Adding cc: A <[email protected] > from line 'From: A <[email protected] >'
199
200
@@ -213,22 +214,27 @@ X-Mailer: X-MAILER-STRING
213
214
Result: OK
214
215
EOF
215
216
216
- test_expect_success ' sendemail.cc set' '
217
- git config sendemail.cc [email protected] &&
217
+ test_suppression () {
218
218
git send-email \
219
219
--dry-run \
220
+ --suppress-cc=$1 \
220
221
--from=
" Example <[email protected] >" \
221
222
222
223
--smtp-server relay.example.com \
223
224
$patches |
224
225
sed -e " s/^\(Date:\).*/\1 DATE-STRING/" \
225
226
-e " s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
226
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 [email protected] &&
234
+ test_suppression sob
229
235
'
230
236
231
- cat > expected-show-all-headers << \EOF
237
+ cat > expected-suppress-sob << \EOF
232
238
0001-Second.patch
233
239
(mbox) Adding cc: A <[email protected] > from line 'From: A <[email protected] >'
234
240
@@ -250,17 +256,123 @@ EOF
250
256
251
257
test_expect_success ' sendemail.cc unset' '
252
258
git config --unset sendemail.cc &&
253
- git send-email \
254
- --dry-run \
255
- --from="Example <[email protected] >" \
256
-
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
+
267
+
268
+
269
+
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 <[email protected] > from line 'From: A <[email protected] >'
285
+
286
+
287
+ Dry-OK. Log says:
288
+ Server: relay.example.com
289
+
290
+
291
+
292
+
293
+
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 <[email protected] > from line 'From: A <[email protected] >'
309
+
310
+
311
+ Dry-OK. Log says:
312
+ Server: relay.example.com
313
+
314
+
315
+
316
+
317
+
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 <[email protected] > from line 'From: A <[email protected] >'
333
+
334
+
335
+ (body) Adding cc: C O Mitter <[email protected] > from line 'Signed-off-by: C O Mitter <[email protected] >'
336
+ Dry-OK. Log says:
337
+ Server: relay.example.com
338
+
339
+
340
+
341
+
342
+
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 <[email protected] > from line 'From: A <[email protected] >'
358
+ (body) Adding cc: C O Mitter <[email protected] > from line 'Signed-off-by: C O Mitter <[email protected] >'
359
+ Dry-OK. Log says:
360
+ Server: relay.example.com
361
+
362
+
363
+
364
+
365
+
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
264
376
'
265
377
266
378
test_expect_success ' --compose adds MIME for utf8 body' '
0 commit comments