aboutsummaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorMirko Faina <mroik@delayed.space>2026-03-23 17:57:30 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-23 13:06:58 -0700
commit67ea2ad7d1b006194762cbfcc0b7801ffe652ca4 (patch)
treeba32e5ceaf94c19646bbc9382cdddf5c24aa5171 /t/t4014-format-patch.sh
parent3482b4278793f3adb1fa811dd30c637563ca9cec (diff)
downloadgit-67ea2ad7d1b006194762cbfcc0b7801ffe652ca4.tar.xz
format-patch: rename --cover-letter-format option
To align the name of the configuration variable and the name of the command line option, either one should change name. By changing the name of the option we get the added benefit of having --cover-<TAB> expand to --cover-letter without ambiguity. If the user gives the --cover-letter-format option it would be reasonable to expect that the user wants to generate the cover letter despite not giving --cover-letter. Rename --cover-letter-format to --commit-list-format and make it imply --cover-letter unless --no-cover-letter is given. Signed-off-by: Mirko Faina <mroik@delayed.space> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh41
1 files changed, 21 insertions, 20 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 7c67bdf922..d2a775f78d 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -383,49 +383,50 @@ test_expect_success 'filename limit applies only to basename' '
test_expect_success 'cover letter with subject, author and count' '
rm -rf patches &&
test_when_finished "git reset --hard HEAD~1" &&
- test_when_finished "rm -rf patches result test_file" &&
+ test_when_finished "rm -rf patches test_file" &&
touch test_file &&
git add test_file &&
git commit -m "This is a subject" &&
- git format-patch --cover-letter \
- --cover-letter-format="log:[%(count)/%(total)] %s (%an)" -o patches HEAD~1 &&
- grep "^\[1/1\] This is a subject (A U Thor)$" patches/0000-cover-letter.patch >result &&
- test_line_count = 1 result
+ git format-patch --commit-list-format="log:[%(count)/%(total)] %s (%an)" \
+ -o patches HEAD~1 &&
+ test_grep "^\[1/1\] This is a subject (A U Thor)$" patches/0000-cover-letter.patch
'
-test_expected_success 'cover letter with author and count' '
+test_expect_success 'cover letter with author and count' '
test_when_finished "git reset --hard HEAD~1" &&
- test_when_finished "rm -rf patches result test_file" &&
+ test_when_finished "rm -rf patches test_file" &&
touch test_file &&
git add test_file &&
git commit -m "This is a subject" &&
- git format-patch --cover-letter \
- --cover-letter-format="log:[%(count)/%(total)] %an" -o patches HEAD~1 &&
- grep "^\[1/1\] A U Thor$" patches/0000-cover-letter.patch >result &&
- test_line_count = 1 result
+ git format-patch --commit-list-format="log:[%(count)/%(total)] %an" \
+ -o patches HEAD~1 &&
+ test_grep "^\[1/1\] A U Thor$" patches/0000-cover-letter.patch
'
test_expect_success 'cover letter shortlog' '
test_when_finished "git reset --hard HEAD~1" &&
- test_when_finished "rm -rf patches result test_file" &&
+ test_when_finished "rm -rf expect patches result test_file" &&
+ cat >expect <<-"EOF" &&
+ A U Thor (1):
+ This is a subject
+ EOF
touch test_file &&
git add test_file &&
git commit -m "This is a subject" &&
- git format-patch --cover-letter --cover-letter-format=shortlog \
- -o patches HEAD~1 &&
- sed -n -e "/^A U Thor/p;" patches/0000-cover-letter.patch >result &&
- test_line_count = 1 result
+ git format-patch --commit-list-format=shortlog -o patches HEAD~1 &&
+ grep -E -A 1 "^A U Thor \([[:digit:]]+\):$" patches/0000-cover-letter.patch >result &&
+ cat result &&
+ test_cmp expect result
'
-test_expect_success 'cover letter no format' '
+test_expect_success 'no cover letter but with format specified' '
test_when_finished "git reset --hard HEAD~1" &&
test_when_finished "rm -rf patches result test_file" &&
touch test_file &&
git add test_file &&
git commit -m "This is a subject" &&
- git format-patch --cover-letter -o patches HEAD~1 &&
- sed -n -e "/^A U Thor/p;" patches/0000-cover-letter.patch >result &&
- test_line_count = 1 result
+ git format-patch --no-cover-letter --commit-list-format="[%(count)] %s" -o patches HEAD~1 &&
+ test_path_is_missing patches/0000-cover-letter.patch
'
test_expect_success 'cover letter config with count, subject and author' '