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

Re: [PATCH RFC] builtin/log: include From in git show --format=email

From
AGAntonin Godard <antonin.godard@bootlin.com>
Date
Feb 17, 2025, 12:42 UTC
Message-ID
<D7UQ9PQOTOLT.26JEMSNOV4WP6@bootlin.com>
In-Reply-To
<xmqqh64wl0wl.fsf@gitster.g>
Hi Junio,
On Fri Feb 14, 2025 at 9:35 PM CET, Junio C Hamano wrote:
Show 12 quoted lines
> Antonin Godard <antonin.godard@bootlin.com> writes:
>
>> Currently, when the format.from and format.forceInBodyFrom options are
>> configured, the command `git show --format=email <commit>` command does
>> not include "From: user <email>" in the body, even though I believe it
>> is expected when using this format.
>
> Aren't "format.*" configuration variables for "git format-patch",
> and not "git show" or "git log"?
>
> I do not see there is anything that needs fixing, but I may be
> missing something.

This is what the documentation seems to imply, but builtin/log.c uses these configuration variables in git_log_config(), for example. In the same file, cmd_show() uses git_log_config().

git show can be used with --format=email, and you can use the format.* options to control the output of git show --format=email <ref>. For example:

  git -c format.subjectPrefix=FOO show --format=email HEAD
Will affect the subject.

With this reasoning in mind, I thought "git show --format=email" should also benefit from the format.from and format.forceInBodyFrom variables, to correctly display the output.

I should also mention that b4[1] uses `git show --format=email`[2] to generate the patches. So at the moment any user using b4 does not have their format.from variables satisfied. This is how I spotted this behavior, initially.

[1]: https://b4.docs.kernel.org/en/latest [2]: https://git.kernel.org/pub/scm/utils/b4/b4.git/tree/src/b4/__init__.py#n3487

Antonin
-- 
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “builtin/log: include From in git show --format=email”
  1. builtin/log: include From in git show --format=emailAntonin Godard, Feb 14, 2025
  2. Junio C HamanoFeb 14, 2025
  3. Antonin GodardFeb 17, 2025
  4. Junio C HamanoFeb 18, 2025

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.