From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git List Mailing <git@vger.kernel.org>
Subject: Re: "Problems" with git format-patch --thread email header ordering
Date: Fri, 15 Mar 2019 13:47:15 +0900 [thread overview]
Message-ID: <xmqqk1h09224.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CAHk-=whP1stFZNAaJiMi5eZ9rj0MRt20Y_yHVczZPH+O01d+sA@mail.gmail.com> (Linus Torvalds's message of "Thu, 14 Mar 2019 16:44:51 -0700")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> While it's true that header ordering isn't specified, there's a common
> "canonical" order that the headers are listed in. To quote rfc822:
> ...
> body must occur AFTER the headers. It is recommended
> that, if present, headers be sent in the order "Return-
> Path", "Received", "Date", "From", "Subject", "Sender",
> "To", "cc", etc.
>
> But git format-patch does create the email headers out in a different
> order than the one recommended. When you do "git format-patch
> --thread" to create the emails, the header ordering looks roughly like
> this:
>
> Message-Id: <cover.1552606170.git.torvalds@linux-foundation.org>
> From: Linus Torvalds <torvalds@linux-foundation.org>
> Date: Thu, 14 Mar 2019 16:29:30 -0700
> Subject: [PATCH 0/6] *** SUBJECT HERE ***
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> ...
> And yes, if somebody from Google on this list wants to bring this up
> with the gmail team, I wish you the best of luck. Let me know how it
> goes.
I obviously won't do the last one myself, but if the issue is only
to swap from and date, then this may be sufficient, perhaps?
I suspect that there would be fallouts in t/ directory before we can
call this a fix.
pretty.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/pretty.c b/pretty.c
index f496f0f128..40c7236fbc 100644
--- a/pretty.c
+++ b/pretty.c
@@ -452,6 +452,14 @@ void pp_user_info(struct pretty_print_context *pp,
map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen);
if (cmit_fmt_is_mail(pp->fmt)) {
+
+ /*
+ * Date: before From:
+ * cf. <CAHk-=whP1stFZNAaJiMi5eZ9rj0MRt20Y_yHVczZPH+O01d+sA@mail.gmail.com>
+ */
+ strbuf_addf(sb, "Date: %s\n",
+ show_ident_date(&ident, DATE_MODE(RFC2822)));
+
if (pp->from_ident && ident_cmp(pp->from_ident, &ident)) {
struct strbuf buf = STRBUF_INIT;
@@ -502,8 +510,7 @@ void pp_user_info(struct pretty_print_context *pp,
break;
case CMIT_FMT_EMAIL:
case CMIT_FMT_MBOXRD:
- strbuf_addf(sb, "Date: %s\n",
- show_ident_date(&ident, DATE_MODE(RFC2822)));
+ /* has been done much earlier */
break;
case CMIT_FMT_FULLER:
strbuf_addf(sb, "%sDate: %s\n", what,
next prev parent reply other threads:[~2019-03-15 4:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 23:44 "Problems" with git format-patch --thread email header ordering Linus Torvalds
2019-03-15 4:47 ` Junio C Hamano [this message]
2019-03-15 16:59 ` Linus Torvalds
2019-04-04 18:06 ` Julian Andres Klode
2019-04-05 5:24 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk1h09224.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).