Merge branch 'rj/format-patch-auto-cover-with-interdiff'

"git format-patch --interdiff" for multi-patch series learned to
turn on cover letters automatically (unless told never to enable
cover letter with "--no-cover-letter" and such).

* rj/format-patch-auto-cover-with-interdiff:
  format-patch: assume --cover-letter for diff in multi-patch series
  t4014: cleanups in a few tests
This commit is contained in:
Junio C Hamano
2024-06-20 15:45:12 -07:00
3 changed files with 36 additions and 5 deletions

View File

@ -820,8 +820,8 @@ test_expect_success 'format-patch --notes --signoff' '
'
test_expect_success 'format-patch notes output control' '
test_when_finished "git notes remove HEAD || :" &&
git notes add -m "notes config message" HEAD &&
test_when_finished git notes remove HEAD &&
git format-patch -1 --stdout >out &&
! grep "notes config message" out &&
@ -848,10 +848,10 @@ test_expect_success 'format-patch notes output control' '
'
test_expect_success 'format-patch with multiple notes refs' '
test_when_finished "git notes --ref note1 remove HEAD;
git notes --ref note2 remove HEAD || :" &&
git notes --ref note1 add -m "this is note 1" HEAD &&
test_when_finished git notes --ref note1 remove HEAD &&
git notes --ref note2 add -m "this is note 2" HEAD &&
test_when_finished git notes --ref note2 remove HEAD &&
git format-patch -1 --stdout >out &&
! grep "this is note 1" out &&
@ -892,10 +892,10 @@ test_expect_success 'format-patch with multiple notes refs' '
test_expect_success 'format-patch with multiple notes refs in config' '
test_when_finished "test_unconfig format.notes" &&
test_when_finished "git notes --ref note1 remove HEAD;
git notes --ref note2 remove HEAD || :" &&
git notes --ref note1 add -m "this is note 1" HEAD &&
test_when_finished git notes --ref note1 remove HEAD &&
git notes --ref note2 add -m "this is note 2" HEAD &&
test_when_finished git notes --ref note2 remove HEAD &&
git config format.notes note1 &&
git format-patch -1 --stdout >out &&
@ -2516,6 +2516,21 @@ test_expect_success 'range-diff: solo-patch' '
test_cmp expect actual
'
test_expect_success 'interdiff: multi-patch, implicit --cover-letter' '
test_when_finished "rm -f v23-0*.patch" &&
git format-patch --interdiff=boop~2 -2 -v23 &&
test_grep "^Interdiff against v22:$" v23-0000-cover-letter.patch &&
test_cmp expect actual
'
test_expect_success 'interdiff: explicit --no-cover-letter defeats implied --cover-letter' '
test_when_finished "rm -f v23-0*.patch" &&
test_must_fail git format-patch --no-cover-letter \
--interdiff=boop~2 -2 -v23 &&
test_must_fail git -c format.coverLetter=no format-patch \
--interdiff=boop~2 -2 -v23
'
test_expect_success 'format-patch does not respect diff.noprefix' '
git -c diff.noprefix format-patch -1 --stdout >actual &&
grep "^--- a/blorp" actual