aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMirko Faina <mroik@delayed.space>2026-02-18 00:25:18 +0100
committerJunio C Hamano <gitster@pobox.com>2026-02-17 15:29:57 -0800
commita8e89346a7731cb3104010f322c65e2a0c922618 (patch)
treed2f2e3f3c878d2b3f5fb0ad3aa06f54592194fd0 /t
parent67ad42147a7acc2af6074753ebd03d904476118f (diff)
downloadgit-a8e89346a7731cb3104010f322c65e2a0c922618.tar.xz
format-patch: fix From header in cover letter
"git format-patch" takes "--from=<user ident>" command line option and uses the given ident for patch e-mails, but this is not applied to the cover letter, the option is ignored and the committer ident of the current user is used. This has been the case ever since "--from" was introduced in a9080475 (teach format-patch to place other authors into in-body "From", 2013-07-03). Teach the make_cover_letter() function to honor the option, instead of always using the current committer identity. Change variable name from "committer" to "from" to better reflect the purpose of the variable. Signed-off-by: Mirko Faina <mroik@delayed.space> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4014-format-patch.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 21d6d0cd9e..2135b65cee 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -1472,6 +1472,14 @@ test_expect_success '--from uses committer ident' '
test_cmp expect patch.head
'
+test_expect_success '--from applies to cover letter' '
+ test_when_finished "rm -rf patches" &&
+ git format-patch -1 --cover-letter --from="Foo Bar <author@example.com>" -o patches &&
+ echo "From: Foo Bar <author@example.com>" >expect &&
+ grep "^From:" patches/0000-cover-letter.patch >patch.head &&
+ test_cmp expect patch.head
+'
+
test_expect_success '--from omits redundant in-body header' '
git format-patch -1 --stdout --from="A U Thor <author@example.com>" >patch &&
cat >expect <<-\EOF &&