git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] format-patch: fix from header in cover letter

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2026, 11:01 UTC
Message-ID
<xmqqv7fxdkay.fsf@gitster.g>
In-Reply-To
<aZAMr6XOwKkTa55q@exploit>
Mirko Faina <mroik@delayed.space> writes:
> Subject: Re: [PATCH] format-patch: fix from header in cover letter
Thanks.  That reads well.
> From: Mroik <mroik@delayed.space>

The ident used here matches what is used on the signed-off-by line, which is good. We tend to prefer people to use their real names, though (and I suspect that your name probably has some multi-word structure, not a single-word).

> Fixes "From" header for the cover letter when `--from` is passed
The usual way to compose a log message of this project is to
 - Give an observation on how the current system works in the
   present tense (so no need to say "Currently X is Y", or
   "Previously X was Y" to describe the state before your change;
   just "X is Y" is enough), and discuss what you perceive as a
   problem in it.
 - Propose a solution (optional---often, problem description
   trivially leads to an obvious solution in reader's minds).
 - Give commands to somebody editing the codebase to "make it so",
   instead of saying "This commit does X".

in this order. I am guessing that the problem you are fixing, which is not said explicitly in what you wrote, is that even when you run "git format-patch --from='Me <me@my.address>'", the option is not used for cover letter? If that is the case, perhaps I'd write something along this line:

    "git format-patch" takes "--from=<user ident>" command line
    option, and the given ident is used for patch e-mails, but for
    the cover letter e-mail, the option is ignored and the committer
    ident of the current user is used.
    Teach the make_cover_letter() function to honor the option,
    instead of always using the current committer identity.
if I were making this change.
> Signed-off-by: Mroik <mroik@delayed.space>

Again, the ident used here matches what is used on the in-body From: line, which is good.

> ---
>  builtin/log.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This can be tested easily without flakes, so we should add some test in one of the t/t*-format-patch*.sh files to help people notice when they breaks this fix by mistake in the future.

Show 10 quoted lines
> diff --git a/builtin/log.c b/builtin/log.c
> index d43ca693bf..df41b43fce 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -1345,7 +1345,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
>  	if (!cmit_fmt_is_mail(rev->commit_format))
>  		die(_("cover letter needs email format"));
>  
> -	committer = git_committer_info(0);
> +	committer = cfg->from ? cfg->from : git_committer_info(0);

This is a correct and minimal change, but if I were making this change, I'd probably rename the "committer" variable. Before the "--from" option came into play, the function has always assumed that it should make the cover letter message from the current user, using their committer ident, which meant that the "From:" address and the committer ident were synonymous from this function's point of view.

But now we are telling the function that its assumption is no longer good, and teaching it to honor the "From:" address given in the cfg. And the way this local variable is used is to point at a string that is the ident used for the "From:" address, which is not necessarily the same as committer ident in this new world order. So it is not reader-friendly to keep using "committer" as the name of the variable. Simply call it "from", perhaps?

>  	if (use_separate_file &&
>  	    open_next_file(NULL, rev->numbered_files ? NULL : "cover-letter", rev, quiet))
Thanks.
Previous: Mirko FainaNext: Mirko Faina
Message 2 of 17 in “format-patch: fix from header in cover letter”
  1. format-patch: fix from header in cover letterMirko Faina, Feb 14, 2026
  2. Junio C HamanoFeb 16, 2026
  3. format-patch: fix From header in cover letterMirko Faina, Feb 16, 2026
  4. Patrick SteinhardtFeb 17, 2026
  5. Jeff KingFeb 17, 2026
  6. D. Ben KnobleFeb 17, 2026
  7. Jeff KingFeb 19, 2026
  8. Mirko FainaFeb 19, 2026
  9. D. Ben KnobleFeb 19, 2026
  10. Junio C HamanoFeb 17, 2026
  11. Jeff KingFeb 19, 2026
  12. Junio C HamanoFeb 20, 2026
  13. format-patch: fix From header in cover letterMroik, Feb 17, 2026
  14. Mirko FainaFeb 17, 2026
  15. Junio C HamanoFeb 17, 2026
  16. Junio C HamanoFeb 17, 2026
  17. format-patch: fix From header in cover letterMirko Faina, Feb 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.