{"thread":{"id":"26573","subject":"How do I make git-format-patch reject 8-bit encodings?","startedAt":"2011-02-21T22:11:33Z","lastAt":"2011-02-22T14:49:03Z","messageCount":5,"participants":["Timur Tabi","Junio C Hamano","Tabi Timur-B04825","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"161839","messageId":"4D62E315.7040506@freescale.com","threadId":"26573","inReplyTo":null,"subject":"How do I make git-format-patch reject 8-bit encodings?","fromName":"Timur Tabi","fromEmail":"timur@freescale.com","sentAt":"2011-02-21T22:11:33Z","receivedAt":"2011-02-21T22:11:33Z","isPatch":false,"sender":{"key":"timur@freescale.com","avatar":null},"body":"Is there any way to get git-format-patch to refuse to create a patch that has\n8-bit characters in it?  That is, if a given commit somehow has an 8-bit\ncharacter (e.g. utf-encoded), then I want git-format-patch to refuse to create a\npatch for that commit.\n\nAlso, how can I do the same thing with git-send-email?  That is, if the patch\nrequires an 8-bit encoding, how do I get it to refuse to send the patch?\n\n-- \nTimur Tabi\nLinux kernel developer at Freescale\n"},{"id":"161849","messageId":"7vbp24hqez.fsf@alter.siamese.dyndns.org","threadId":"26573","inReplyTo":"4D62E315.7040506@freescale.com","subject":"Re: How do I make git-format-patch reject 8-bit encodings?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-22T00:19:16Z","receivedAt":"2011-02-22T00:19:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Timur Tabi <timur@freescale.com> writes:\n\n> Is there any way to get git-format-patch to refuse to create a patch that has\n> 8-bit characters in it?  That is, if a given commit somehow has an 8-bit\n> character (e.g. utf-encoded), then I want git-format-patch to refuse to create a\n> patch for that commit.\n>\n> Also, how can I do the same thing with git-send-email?  That is, if the patch\n> requires an 8-bit encoding, how do I get it to refuse to send the patch?\n\nFeels like an X-Y problem, but wouldn't it be an option to let\nformat-patch write into individual files, check these files and reject\nones that are not 8-bit clean, and then send the result out via\nsend-email?  You should be proofreading the format-patch output to catch\nand fix typos before hading them to send-email anyway, so the above would\nbe the natural thing to do.\n"},{"id":"161850","messageId":"4D6302E6.1070602@freescale.com","threadId":"26573","inReplyTo":"7vbp24hqez.fsf@alter.siamese.dyndns.org","subject":"Re: How do I make git-format-patch reject 8-bit encodings?","fromName":"Tabi Timur-B04825","fromEmail":"b04825@freescale.com","sentAt":"2011-02-22T00:27:19Z","receivedAt":"2011-02-22T00:27:19Z","isPatch":false,"sender":{"key":"b04825@freescale.com","avatar":null},"body":"Junio C Hamano wrote:\n> Feels like an X-Y problem, but wouldn't it be an option to let\n> format-patch write into individual files, check these files and reject\n> ones that are not 8-bit clean, and then send the result out via\n> send-email?  You should be proofreading the format-patch output to catch\n> and fix typos before hading them to send-email anyway, so the above would\n> be the natural thing to do.\n\nThe problem is that it appears that git-send-email is taking normal-looking patches and encoding them as base64, and I don't know about it until after the email is sent.  It also appears to be inconsistent.  I've seen some utf-8 patches emailed as normal text, and other patches emailed as base64.\n\nI don't have any real problem with utf-8, but I want to prevent git-send-email from doing base64 encodings on its own.\n\n-- \nTimur Tabi\nLinux kernel developer\n"},{"id":"161862","messageId":"20110222073330.GA8626@sigill.intra.peff.net","threadId":"26573","inReplyTo":"4D6302E6.1070602@freescale.com","subject":"Re: How do I make git-format-patch reject 8-bit encodings?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-22T07:33:30Z","receivedAt":"2011-02-22T07:33:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 22, 2011 at 12:27:19AM +0000, Tabi Timur-B04825 wrote:\n\n> Junio C Hamano wrote:\n> > Feels like an X-Y problem, but wouldn't it be an option to let\n> > format-patch write into individual files, check these files and reject\n> > ones that are not 8-bit clean, and then send the result out via\n> > send-email?  You should be proofreading the format-patch output to catch\n> > and fix typos before hading them to send-email anyway, so the above would\n> > be the natural thing to do.\n> \n> The problem is that it appears that git-send-email is taking\n> normal-looking patches and encoding them as base64, and I don't know\n> about it until after the email is sent.\n\nCan you provide an example of a message that is base64-encoded? I didn't\nthink we base64-encoded anything in send-email (we do rfc2047-encode\n8-bit header lines, but using quoted-printable). And looking through it,\nI don't see any code to do so.\n\nIt's possible that I'm missing the code. Or that one of the underlying\nmodules is doing it for us. Or it's possible that one of the SMTP\nservers in your route is doing it.\n\nIf you can send an example of original format-patch output that you fed\nto git-send-email, and the resulting mail that was delivered, then we\ncan know more.\n\nI have a suspicion it is the last one (some MTA doing it), because git\ntends to generate messages with an 8bit transfer encoding. If we hit a\nserver that doesn't advertise support for 8BIT SMTP extensions, I\nbelieve the sending MTA is required to encode (or bounce). That would\nalso account for the inconsistency you noted. It depends on the\nrecipient and the exact route of SMTP servers in the delivery.\n\n-Peff\n"},{"id":"161879","messageId":"4D63CCDF.50803@freescale.com","threadId":"26573","inReplyTo":"20110222073330.GA8626@sigill.intra.peff.net","subject":"Re: How do I make git-format-patch reject 8-bit encodings?","fromName":"Timur Tabi","fromEmail":"timur@freescale.com","sentAt":"2011-02-22T14:49:03Z","receivedAt":"2011-02-22T14:49:03Z","isPatch":false,"sender":{"key":"timur@freescale.com","avatar":null},"body":"Jeff King wrote:\n> Can you provide an example of a message that is base64-encoded? I didn't\n> think we base64-encoded anything in send-email (we do rfc2047-encode\n> 8-bit header lines, but using quoted-printable). And looking through it,\n> I don't see any code to do so.\n\nI can forward to you the original email that is base64-encoded, but I cannot\nreproduce the problem.  Even when I take that patch, apply it with git-am and\nrecreate it with git-format-patch, when I sent that recreate patch with\ngit-send-email, it is not base64 encoded.\n\n> It's possible that I'm missing the code. Or that one of the underlying\n> modules is doing it for us. Or it's possible that one of the SMTP\n> servers in your route is doing it.\n\nIt is possible that our mail server is doing it.  We recently migrated to the\n\"Microsoft cloud\" email service, and we've experienced all sorts of odd problems\nwith mailing patches.\n\n> If you can send an example of original format-patch output that you fed\n> to git-send-email, and the resulting mail that was delivered, then we\n> can know more.\n\nI don't know if I can still get the original patch that was encoded.\n\n> I have a suspicion it is the last one (some MTA doing it), because git\n> tends to generate messages with an 8bit transfer encoding. If we hit a\n> server that doesn't advertise support for 8BIT SMTP extensions, I\n> believe the sending MTA is required to encode (or bounce). That would\n> also account for the inconsistency you noted. It depends on the\n> recipient and the exact route of SMTP servers in the delivery.\n\nAh, this might be a clue.  I will do more research and get back to you.\n\n-- \nTimur Tabi\nLinux kernel developer at Freescale\n"}]}