diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-08-29 23:38:36 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-29 23:39:13 +0200 |
commit | 34bc1b1045af6ad813f4de662a453b3c77ba65a7 (patch) | |
tree | a7806e9d87faec1d80e9b29d089c206af169a29d /t/t4014-format-patch.sh | |
parent | pretty: separate out the logic to decide the use of in-body from (diff) | |
download | git-34bc1b1045af6ad813f4de662a453b3c77ba65a7.tar.xz git-34bc1b1045af6ad813f4de662a453b3c77ba65a7.zip |
format-patch: allow forcing the use of in-body From: header
Users may be authoring and committing their commits under the same
e-mail address they use to send their patches from, in which case
they shouldn't need to use the in-body From: line in their outgoing
e-mails. At the receiving end, "git am" will use the address on the
"From:" header of the incoming e-mail and all should be well.
Some mailing lists, however, mangle the From: address from what the
original sender had; in such a situation, the user may want to add
the in-body "From:" header even for their own patches.
"git format-patch --[no-]force-in-body-from" was invented for such
users.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-x | t/t4014-format-patch.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index fbec8ad2ef..347f7f7f35 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1400,6 +1400,19 @@ test_expect_success '--from omits redundant in-body header' ' test_cmp expect patch.head ' +test_expect_success 'with --force-in-body-from, redundant in-body from is kept' ' + git format-patch --force-in-body-from \ + -1 --stdout --from="A U Thor <author@example.com>" >patch && + cat >expect <<-\EOF && + From: A U Thor <author@example.com> + + From: A U Thor <author@example.com> + + EOF + sed -ne "/^From:/p; /^$/p; /^---$/q" patch >patch.head && + test_cmp expect patch.head +' + test_expect_success 'in-body headers trigger content encoding' ' test_env GIT_AUTHOR_NAME="éxötìc" test_commit exotic && test_when_finished "git reset --hard HEAD^" && |