428
test_line_count = 1 result
429
'
430
431
+test_expect_success 'cover letter config with count, subject and author' '
432
+ test_when_finished "rm -rf patches result" &&
433
+ test_when_finished "git config unset format.coverletter" &&
434
+ test_when_finished "git config unset format.commitlistformat" &&
435
+ git config set format.coverletter true &&
436
+ git config set format.commitlistformat "log:[%(count)/%(total)] %s (%an)" &&
437
+ git format-patch -o patches HEAD~2 &&
438
+ grep -E "^[[[:digit:]]+/[[:digit:]]+] .* \(A U Thor\)" patches/0000-cover-letter.patch >result &&
439
+ test_line_count = 2 result
440
+'
441
+
442
+test_expect_success 'cover letter config with count and author' '
443
+ test_when_finished "rm -rf patches result" &&
444
+ test_when_finished "git config unset format.coverletter" &&
445
+ test_when_finished "git config unset format.commitlistformat" &&
446
+ git config set format.coverletter true &&
447
+ git config set format.commitlistformat "log:[%(count)/%(total)] (%an)" &&
448
+ git format-patch -o patches HEAD~2 &&
449
+ grep -E "^[[[:digit:]]+/[[:digit:]]+] \(A U Thor\)" patches/0000-cover-letter.patch >result &&
450
+ test_line_count = 2 result
451
+'
452
+
453
+test_expect_success 'cover letter config commitlistformat set but no format' '
454
+ test_when_finished "rm -rf patches result" &&
455
+ test_when_finished "git config unset format.coverletter" &&
456
+ test_when_finished "git config unset format.commitlistformat" &&
457
+ git config set format.coverletter true &&
458
+ printf "\tcommitlistformat" >> .git/config &&
459
+ git format-patch -o patches HEAD~2 &&
460
+ grep -E "^[[[:digit:]]+/[[:digit:]]+] .*" patches/0000-cover-letter.patch >result &&
461
+ test_line_count = 2 result
462
+'
463
+
464
+test_expect_success 'cover letter config commitlistformat set to shortlog' '
465
+ test_when_finished "rm -rf patches result" &&
466
+ test_when_finished "git config unset format.coverletter" &&
467
+ test_when_finished "git config unset format.commitlistformat" &&
468
+ git config set format.coverletter true &&
469
+ git config set format.commitlistformat shortlog &&
470
+ git format-patch -o patches HEAD~2 &&
471
+ grep -E "^A U Thor \([[:digit:]]+\)" patches/0000-cover-letter.patch >result &&
472
+ test_line_count = 1 result
473
+'
474
+
475
+test_expect_success 'cover letter config commitlistformat not set' '
476
+ test_when_finished "rm -rf patches result" &&
477
+ test_when_finished "git config unset format.coverletter" &&
478
+ git config set format.coverletter true &&
479
+ git format-patch -o patches HEAD~2 &&
480
+ grep -E "^A U Thor \([[:digit:]]+\)" patches/0000-cover-letter.patch >result &&
481
+ test_line_count = 1 result
482
+'
483
+
484
test_expect_success 'reroll count' '
485
rm -fr patches &&
486
git format-patch -o patches --cover-letter --reroll-count 4 main..side >list &&