[PATCH] Add MIME information to outgoing email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux