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

forcing an in-body From header

From
Rasmus Villemoes <rv@rasmusvillemoes.dk>
Date
Aug 26, 2022, 13:17 UTC
Message-ID
<c403e526-7455-4f26-fcef-97c99f9af539@rasmusvillemoes.dk>
Hi,

Some mailing lists mangle the real From: header, making it a little hard for maintainers to apply patches directly using 'git am'. See e.g. https://lists.openembedded.org/g/openembedded-core/message/166515 . One way to work around that is by having an in-body From: "header".

However, merely setting sendemail.from or format.from is not enough to get such a header, if the value happens to be identical to the patch author (which it would usually be). So, could we get some config knob and/or command line switch to force an in-body from header? Then one could set that on a per-project basis, for projects with such mailing lists.

I looked into the code, and while this is obviously just a hacky patch to see that I found the right spot, it doesn't seem to be too hard to implement properly.

diff --git a/pretty.c b/pretty.c
index ee6114e3f0..8b9ef6f644 100644
--- a/pretty.c
+++ b/pretty.c
@@ -503,7 +503,7 @@ void pp_user_info(struct pretty_print_context *pp,
                map_user(pp->mailmap, &mailbuf, &maillen, &namebuf,
&namelen);

        if (cmit_fmt_is_mail(pp->fmt)) {
-               if (pp->from_ident && ident_cmp(pp->from_ident, &ident)) {
+               if (pp->from_ident && (ident_cmp(pp->from_ident, &ident)
|| getenv("GIT_FORCE_BODY_FROM"))) {
                        struct strbuf buf = STRBUF_INIT;

                        strbuf_addstr(&buf, "From: ");

Thanks,
Rasmus
Next: Konstantin Ryabitsev
Message 1 of 5 in “forcing an in-body From header”
  1. Rasmus VillemoesAug 26, 2022
  2. Konstantin RyabitsevAug 26, 2022
  3. Junio C HamanoAug 26, 2022
  4. Rasmus VillemoesAug 29, 2022
  5. Junio C HamanoAug 26, 2022

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.