Re: [PATCH RFC] builtin/log: include From in git show --format=email
- From
- Antonin 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