git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@rfc1149.net>
To: git@vger.kernel.org
Cc: Samuel Tardieu <sam@rfc1149.net>
Subject: [PATCH] Add MIME information to outgoing email
Date: Thu, 13 Mar 2008 17:40:19 +0100	[thread overview]
Message-ID: <1205426419-4594-1-git-send-email-sam@rfc1149.net> (raw)

Add MIME-Version/Content-Type/Content-Transfer-Encoding headers in
messages generated with git-format-patch. Without it, messages generated
without using --attach or --inline didn't have any content type information.

I got hit with this problem yesterday when sending a patch to linux-kernel
with a commit message containing the name "Pádraig" in it. Moreover,
the mailing-list software added an incorrect ISO-8859-1 encoding information
which mangled Pádraig's name.

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
---
 log-tree.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 608f697..0dacf63 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -198,7 +198,16 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
 			 opt->no_inline ? "attachment" : "inline",
 			 name);
 		opt->diffopt.stat_sep = buffer;
-	}
+	} else {
+		static char buffer[1024];
+		snprintf(buffer, sizeof(buffer) - 1,
+			 "%s"
+			 "MIME-Version: 1.0\n"
+			 "Content-Type: text/plain; charset=UTF-8; format=fixed\n"
+			 "Content-Transfer-Encoding: 8bit\n",
+			 extra_headers ? extra_headers : "");
+		extra_headers = buffer;
+	};
 	*subject_p = subject;
 	*extra_headers_p = extra_headers;
 }
-- 
1.5.4.4.653.g7cf1e.dirty

             reply	other threads:[~2008-03-13 16:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 16:40 Samuel Tardieu [this message]
2008-03-13 17:00 ` [PATCH] Add MIME information to outgoing email Jeff King
2008-03-13 17:14   ` Samuel Tardieu
2008-03-14 13:29     ` Jeff King
2008-03-14 13:40       ` Samuel Tardieu
2008-03-14 13:46         ` Jeff King
2008-03-14 13:50           ` Samuel Tardieu
2008-03-14 14:35             ` Jeff King
2008-03-14 14:40               ` Samuel Tardieu
2008-03-14 16:20   ` Junio C Hamano
2008-03-14 20:21     ` Re* " Junio C Hamano
2008-03-14 21:27       ` Jeff King
2008-03-13 18:48 ` Junio C Hamano
2008-03-13 19:05   ` Samuel Tardieu
2008-03-14 11:21     ` Brian Swetland
2008-03-14 11:57       ` Samuel Tardieu
2008-03-25 18:31   ` MIME headers in introductory message (git send-email --compose) Teemu Likonen
2008-03-25 19:17     ` Jay Soffian
2008-03-25 20:47       ` Junio C Hamano
2008-03-25 20:59         ` Jay Soffian
2008-03-25 21:56         ` Jeff King
2008-03-25 22:07           ` Jeff King
2008-03-25 23:06     ` Jeff King
2008-03-26  2:46       ` Jay Soffian
2008-04-10 18:47       ` Jan Hudec

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=1205426419-4594-1-git-send-email-sam@rfc1149.net \
    --to=sam@rfc1149.net \
    --cc=git@vger.kernel.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.
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 NNTP newsgroup(s).