All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rv@rasmusvillemoes.dk>
To: Git Mailing List <git@vger.kernel.org>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
Subject: forcing an in-body From header
Date: Fri, 26 Aug 2022 15:17:34 +0200	[thread overview]
Message-ID: <c403e526-7455-4f26-fcef-97c99f9af539@rasmusvillemoes.dk> (raw)

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

             reply	other threads:[~2022-08-26 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 13:17 Rasmus Villemoes [this message]
2022-08-26 16:48 ` forcing an in-body From header Konstantin Ryabitsev
2022-08-26 17:20   ` Junio C Hamano
2022-08-29 11:56     ` Rasmus Villemoes
2022-08-26 17:11 ` Junio C Hamano

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=c403e526-7455-4f26-fcef-97c99f9af539@rasmusvillemoes.dk \
    --to=rv@rasmusvillemoes.dk \
    --cc=git@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.