From: Junio C Hamano <gitster@pobox.com>
To: Mroik <mroik@delayed.space>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Jeff King <peff@peff.net>,
"D . Ben Knoble" <ben.knoble@gmail.com>
Subject: Re: [PATCH] format-patch: fix From header in cover letter
Date: Tue, 17 Feb 2026 14:41:52 -0800 [thread overview]
Message-ID: <xmqq7bsb9emn.fsf@gitster.g> (raw)
In-Reply-To: <20260217220515.14127-1-mroik@delayed.space> (mroik@delayed.space's message of "Tue, 17 Feb 2026 23:04:39 +0100")
Mroik <mroik@delayed.space> writes:
> From: Mirko Faina <mroik@delayed.space>
>
> "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.
It is worth noting that ever since this "--from" option was
introduced, it was not used when generating the cover letter in the
proposed log message in the above paragraph somewhere.
> Teach the make_cover_letter() function to honor the option, instead of
> always using the current committer identity.
Also the reasoning behind the rename of "committer" to "from" is
worth noting here.
> diff --git a/Documentation/git-format-patch.adoc b/Documentation/git-format-patch.adoc
> index 9a7807ca71..05c4192dbc 100644
> --- a/Documentation/git-format-patch.adoc
> +++ b/Documentation/git-format-patch.adoc
> @@ -282,11 +282,11 @@ e.g., `--rfc='-(WIP)'` results in "PATCH (WIP)".
>
> --from::
> --from=<ident>::
> - Use `ident` in the `From:` header of each commit email. If the
> - author ident of the commit is not textually identical to the
> - provided `ident`, place a `From:` header in the body of the
> - message with the original author. If no `ident` is given, use
> - the committer ident.
> + Use `ident` in the `From:` header of each email. In case of a
> + commit email, if the author ident of the commit is not textually
> + identical to the provided `ident`, place a `From:` header in the
> + body of the message with the original author. If no `ident` is
> + given, use the committer ident.
After reading the above three times, a natural question that comes
to mind is what ident is used when this option is not given at all
(i.e., "When this option is not given, the committer identity of the
current user is used for all messages").
> diff --git a/builtin/log.c b/builtin/log.c
> index d43ca693bf..42648dda54 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
The code changes all look good.
> 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
> +'
OK.
We know what filename the cover letter gets, so it is really the
matter of how we want to verify the output. We know that a line
that matches "^From:" must appear once and only once in the cover
letter output, so finding that line and comparing it with what we
expect to see is a reasonably way to do this. Good.
Thanks.
next prev parent reply other threads:[~2026-02-17 22:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 5:49 [PATCH] format-patch: fix from header in cover letter Mirko Faina
2026-02-16 11:01 ` Junio C Hamano
2026-02-16 15:27 ` [PATCH v2] format-patch: fix From " Mirko Faina
2026-02-17 6:22 ` Patrick Steinhardt
2026-02-17 6:34 ` Jeff King
2026-02-17 13:21 ` D. Ben Knoble
2026-02-19 11:29 ` Jeff King
2026-02-19 12:03 ` Mirko Faina
2026-02-19 13:43 ` D. Ben Knoble
2026-02-17 15:22 ` Junio C Hamano
2026-02-19 11:43 ` Jeff King
2026-02-20 18:11 ` Junio C Hamano
2026-02-17 22:04 ` [PATCH] " Mroik
2026-02-17 22:13 ` Mirko Faina
2026-02-17 22:43 ` Junio C Hamano
2026-02-17 22:41 ` Junio C Hamano [this message]
2026-02-17 23:25 ` [PATCH v4] " Mirko Faina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq7bsb9emn.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=mroik@delayed.space \
--cc=peff@peff.net \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox