{"thread":{"id":"21464","subject":"Problem with \"From:\" line on \"git format-patch\" generated patches","startedAt":"2009-11-03T16:30:43Z","lastAt":"2009-11-04T10:59:25Z","messageCount":8,"participants":["André Goddard Rosa","Santi Béjar","Jonathan Nieder","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126656","messageId":"b8bf37780911030830l42ea6dc2v3ef66e2a9e1ca281@mail.gmail.com","threadId":"21464","inReplyTo":null,"subject":"Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2009-11-03T16:30:43Z","receivedAt":"2009-11-03T16:30:43Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"Hi, everybody!\n\n    When I generate patches using \"git format-patch\" it always makes\nmy name garbled in the \"From:\" line\nas shown below. I'm using openSUSE 11.2 RC 1 (x86_64) with the\nfollowing settings:\n\n        # locale charmap\n        UTF-8\n        # echo $LANG\n        en_US.UTF-8\n\n    I've tried changing my environment to use another encoding like\nISO-8859-1, but it didn't work as well.\n\n    Does someone can explain why does this happens? Any suggestions?\n\nP.s.: the problem never occurs on the commit message (Signed-off-by)\n\n\n>> >From 584d9bfc7c1d41b76a05655b4562b98fcbef6ee4 Mon Sep 17 00:00:00 2001\n>> From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= <andre.goddard@gmail.com>\n>> Date: Sun, 1 Nov 2009 14:09:06 -0200\n>> Subject: [PATCH v2 7/7] vsprintf: factor out skip_space code in a\n>> separate function\n>> MIME-Version: 1.0\n>> Content-Type: text/plain; charset=UTF-8\n>> Content-Transfer-Encoding: 8bit\n>\n> btw., for reviewability's sake, could you please fix your patch\n> submission method to not include such garbled headers in the mail body?\n>\n> (Also, it would be nice to reply-thread the 7 patches on the 0/7 mail,\n> as git-send-email does.)\n\n\nThank you,\nAndré\n"},{"id":"126659","messageId":"adf1fd3d0911030902x15faffcen86644733ffda43d5@mail.gmail.com","threadId":"21464","inReplyTo":"b8bf37780911030830l42ea6dc2v3ef66e2a9e1ca281@mail.gmail.com","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-11-03T17:02:05Z","receivedAt":"2009-11-03T17:02:05Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Nov 3, 2009 at 5:30 PM, André Goddard Rosa\n<andre.goddard@gmail.com> wrote:\n> Hi, everybody!\n>\n>    When I generate patches using \"git format-patch\" it always makes\n> my name garbled in the \"From:\" line\n> as shown below. I'm using openSUSE 11.2 RC 1 (x86_64) with the\n> following settings:\n>\n>        # locale charmap\n>        UTF-8\n>        # echo $LANG\n>        en_US.UTF-8\n>\n>    I've tried changing my environment to use another encoding like\n> ISO-8859-1, but it didn't work as well.\n>\n>    Does someone can explain why does this happens? Any suggestions?\n>\n> P.s.: the problem never occurs on the commit message (Signed-off-by)\n>\n>\n>>> >From 584d9bfc7c1d41b76a05655b4562b98fcbef6ee4 Mon Sep 17 00:00:00 2001\n>>> From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= <andre.goddard@gmail.com>\n>>> Date: Sun, 1 Nov 2009 14:09:06 -0200\n>>> Subject: [PATCH v2 7/7] vsprintf: factor out skip_space code in a\n>>> separate function\n>>> MIME-Version: 1.0\n>>> Content-Type: text/plain; charset=UTF-8\n>>> Content-Transfer-Encoding: 8bit\n\nThis is the normal encoding for email headers where you cannot use\n8bit characters. You have to use a 7bit characters with this\n=?UTF-8... encoding.\n\nYou can check the From: line in your mail, the mail I'm replying:\n\nFrom:\t=?ISO-8859-1?Q?Andr=E9_Goddard_Rosa?= <andre.goddard@gmail.com>\n\nAt the other hand the tools using the output of git-format-patch must\ndeal with this all, as they do. git-am handles it well, if not it's a\nbug that should be reported.\n\nHTH,\nSanti\n"},{"id":"126661","messageId":"b8bf37780911031006q4bc4c487xd9db86eb0fa531e7@mail.gmail.com","threadId":"21464","inReplyTo":"adf1fd3d0911030902x15faffcen86644733ffda43d5@mail.gmail.com","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2009-11-03T18:06:39Z","receivedAt":"2009-11-03T18:06:39Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"On 11/3/09, Santi Béjar <santi@agolina.net> wrote:\n> On Tue, Nov 3, 2009 at 5:30 PM, André Goddard Rosa\n> <andre.goddard@gmail.com> wrote:\n>> Hi, everybody!\n>>\n>>    When I generate patches using \"git format-patch\" it always makes\n>> my name garbled in the \"From:\" line\n>> as shown below. I'm using openSUSE 11.2 RC 1 (x86_64) with the\n>> following settings:\n>>\n>>        # locale charmap\n>>        UTF-8\n>>        # echo $LANG\n>>        en_US.UTF-8\n>>\n>>    I've tried changing my environment to use another encoding like\n>> ISO-8859-1, but it didn't work as well.\n>>\n>>    Does someone can explain why does this happens? Any suggestions?\n>>\n>> P.s.: the problem never occurs on the commit message (Signed-off-by)\n>>\n>>>> >From 584d9bfc7c1d41b76a05655b4562b98fcbef6ee4 Mon Sep 17 00:00:00 2001\n>>>> From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= <andre.goddard@gmail.com>\n>>>> Date: Sun, 1 Nov 2009 14:09:06 -0200\n>>>> Subject: [PATCH v2 7/7] vsprintf: factor out skip_space code in a\n>>>> separate function\n>>>> MIME-Version: 1.0\n>>>> Content-Type: text/plain; charset=UTF-8\n>>>> Content-Transfer-Encoding: 8bit\n>\n> This is the normal encoding for email headers where you cannot use\n> 8bit characters. You have to use a 7bit characters with this\n> =?UTF-8... encoding.\n>\n> You can check the From: line in your mail, the mail I'm replying:\n>\n> From:\t=?ISO-8859-1?Q?Andr=E9_Goddard_Rosa?= <andre.goddard@gmail.com>\n>\n> At the other hand the tools using the output of git-format-patch must\n> deal with this all, as they do. git-am handles it well, if not it's a\n> bug that should be reported.\n>\n\nGreat, Santi!\n\n     I really appreciate your reply!!!\n\n    I was just in the process of debugging this issue when I landed\ninto function pp_user_info(), which calls add_rfc2047(). So I started\nlooking into http://www.faqs.org/rfcs/rfc2047.html , which specifies:\n\n\"Generally, an \"encoded-word\" is a sequence of printable ASCII\ncharacters that begins with \"=?\", ends with \"?=\", and has two \"?\"s in\nbetween.\"\n\nOk... I got it; it's necessary for proper signaling of the email\nheader when it detects the presence of certain characters outside the\nASCII range 0..127 (7 bits). It's the case for latin \"é\" letter in my\nname.\n\nSo, let me explain what happened to me:\n\nI'm not using any specific tool for inputting the git-format-patch,\nbut instead I'm sending the files generated by it through gmail as an\ninlined patch in the email body.\n\nI like the convenience of format-patch for generating the patch files,\nbut in this case, formatting the header as rfc2047 is not necessary\nand makes a funny/garbled output in my patch submission.\n\nDo you have a suggestion for my workflow?\n\nThanks a lot,\nAndré\n"},{"id":"126662","messageId":"b8bf37780911031011v5c8ec684ke6eebc6b0de1a66a@mail.gmail.com","threadId":"21464","inReplyTo":"b8bf37780911031006q4bc4c487xd9db86eb0fa531e7@mail.gmail.com","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2009-11-03T18:11:58Z","receivedAt":"2009-11-03T18:11:58Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"> I'm not using any specific tool for inputting the git-format-patch,\n> but instead I'm sending the files generated by it through gmail as an\n> inlined patch in the email body.\n>\n> I like the convenience of format-patch for generating the patch files,\n> but in this case, formatting the header as rfc2047 is not necessary\n> and makes a funny/garbled output in my patch submission.\n>\n> Do you have a suggestion for my workflow?\n>\n\nI really would like continuing having the convenience of using a web\naccess to my gmail for sending the patches, so I just need a way to\nformat the patches which makes it easy submitting them later. I'd like\nto avoid using any other email client for that, if possible.\n"},{"id":"126686","messageId":"20091103225556.GA20160@progeny.tock","threadId":"21464","inReplyTo":"b8bf37780911031011v5c8ec684ke6eebc6b0de1a66a@mail.gmail.com","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2009-11-03T22:55:56Z","receivedAt":"2009-11-03T22:55:56Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi André,\n\nAndré Goddard Rosa wrote:\n\n>> I'm not using any specific tool for inputting the git-format-patch,\n>> but instead I'm sending the files generated by it through gmail as an\n>> inlined patch in the email body.\n>>\n>> I like the convenience of format-patch for generating the patch files,\n>> but in this case, formatting the header as rfc2047 is not necessary\n>> and makes a funny/garbled output in my patch submission.\n\nThe header fields git format-patch outputs are just intended as a\nstarting point for the header of your mailing.  It is more convenient\nto receive an e-mail with\n\n\tDelivered-to: maintainer@example.com\n\tReceived: [...]\n\tMessage-ID: <patch.sender.0001@example.com>\n\tDate: Tue, 03 Nov 2009 16:33:54 -0600\n\tFrom: Patch Sender <patch.sender@example.com>\n\tSubject: [PATCH] Fix one bug, add another\n\tContent-Type: text/plain; charset=us-ascii\n\n\tBlah blah blah\n\nthan one in which the content includes some useless metadata that was\nalready in the header.  So you should just strip the header out from\nthe body before sending.\n\nThere are three common exceptions: 1) you might want to send a patch\nwritten by someone else, 2) you might want to mark a patch as written\nbefore it was sent, and 3) some people like to receive patches as\nattachments rather than inlined in messages.  For the first two cases,\nthe solution is to include the header fields to change in the body:\n\n\tFrom: Patch Writer <patch.writer@example.com>\n\tDate: Wed, 01 Apr 1970 01:23:45 +0100\n\n\tBlah blah blah\n\t---\n\tHi,\n\n\tPatch Writer wrote this patch a while ago that might be\n\trelevant.  It needed a straightforward one-line change to\n\tapply and is otherwise unchanged.\n\n\tWhat do you think?\n[...]\n\nFor the last case, I think it is most common to send unchanged 'git\nformat-patch' output.  But only the From, Date, and Subject fields\nare actually needed.\n\nI am not sure how well 'git am' copes with non-ascii characters in\nthe pseudo-header lines: I would have guessed it could handle them\nboth rfc2047-encoded and not, but I have not tried.\n\n> I really would like continuing having the convenience of using a web\n> access to my gmail for sending the patches, so I just need a way to\n> format the patches which makes it easy submitting them later. I'd like\n> to avoid using any other email client for that, if possible.\n\nHere, there is another danger: the Gmail web interface does not\nconsider your whitespace precious, so it is very prone to mangling\npatches (especially with long lines).\n\nDocumentation/SubmittingPatches [1] has some advice:\n\n| Gmail\n| -----\n| \n| GMail does not appear to have any way to turn off line wrapping in the web\n| interface, so this will mangle any emails that you send.  You can however\n| use any IMAP email client to connect to the google imap server, and forward\n| the emails through that.  Just make sure to disable line wrapping in that\n| email client.  Alternatively, use \"git send-email\" instead.\n| \n| Submitting properly formatted patches via Gmail is simple now that\n| IMAP support is available. First, edit your ~/.gitconfig to specify your\n| account settings:\n| \n| [imap]\n| \tfolder = \"[Gmail]/Drafts\"\n| \thost = imaps://imap.gmail.com\n| \tuser = user@gmail.com\n| \tpass = p4ssw0rd\n| \tport = 993\n| \tsslverify = false\n| \n| You might need to instead use: folder = \"[Google Mail]/Drafts\" if you get an error\n| that the \"Folder doesn't exist\".\n| \n| Next, ensure that your Gmail settings are correct. In \"Settings\" the\n| \"Use Unicode (UTF-8) encoding for outgoing messages\" should be checked.\n| \n| Once your commits are ready to send to the mailing list, run the following\n| command to send the patch emails to your Gmail Drafts folder.\n| \n| \t$ git format-patch -M --stdout origin/master | git imap-send\n| \n| Go to your Gmail account, open the Drafts folder, find the patch email, fill\n| in the To: and CC: fields and send away!\n\nGood luck.\n\nHope that helps,\nJonathan\n\n[1] <http://git.kernel.org/?p=git/git.git;a=blob_plain;f=Documentation/SubmittingPatches>\nconverting tabs to spaces.  \n"},{"id":"126743","messageId":"20091104084903.GA1137@coredump.intra.peff.net","threadId":"21464","inReplyTo":"b8bf37780911031006q4bc4c487xd9db86eb0fa531e7@mail.gmail.com","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-11-04T08:49:03Z","receivedAt":"2009-11-04T08:49:03Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 03, 2009 at 04:06:39PM -0200, André Goddard Rosa wrote:\n\n> I'm not using any specific tool for inputting the git-format-patch,\n> but instead I'm sending the files generated by it through gmail as an\n> inlined patch in the email body.\n> \n> I like the convenience of format-patch for generating the patch files,\n> but in this case, formatting the header as rfc2047 is not necessary\n> and makes a funny/garbled output in my patch submission.\n> \n> Do you have a suggestion for my workflow?\n\nI don't think there's currently a way to turn off the rfc2047 from\nwithin format-patch. You can generate a single patch with the same\nformat using:\n\n  git log -1 -p --stat --summary \\\n    --pretty=tformat:'From: %an <%ae>%nDate: %aD%nSubject: [PATCH] %s%n%n%b'\n\nbut it won't do nice things like putting one patch in each file.\n\nProbably it would make sense for format-patch to have an option to\nindicate that you are going to inline these patches into a different\nMUA. So drop the 'From' mbox header line, don't rfc2047 encode, and\nmaybe some other behaviors. I do the same thing (including inline in\nmutt), but I just delete the unwanted lines manually, and fortunately my\nname doesn't contain any non-ascii characters. ;)\n\n-Peff\n"},{"id":"126752","messageId":"b8bf37780911040255u53a663b9u60aa97bea750939f@mail.gmail.com","threadId":"21464","inReplyTo":"20091103225556.GA20160@progeny.tock","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2009-11-04T10:55:49Z","receivedAt":"2009-11-04T10:55:49Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"On 11/3/09, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Hi André,\n>\n> André Goddard Rosa wrote:\n>\n>>> I'm not using any specific tool for inputting the git-format-patch,\n>>> but instead I'm sending the files generated by it through gmail as an\n>>> inlined patch in the email body.\n>>>\n>>> I like the convenience of format-patch for generating the patch files,\n>>> but in this case, formatting the header as rfc2047 is not necessary\n>>> and makes a funny/garbled output in my patch submission.\n>\n> The header fields git format-patch outputs are just intended as a\n> starting point for the header of your mailing.  It is more convenient\n> to receive an e-mail with\n>\n> \tDelivered-to: maintainer@example.com\n> \tReceived: [...]\n> \tMessage-ID: <patch.sender.0001@example.com>\n> \tDate: Tue, 03 Nov 2009 16:33:54 -0600\n> \tFrom: Patch Sender <patch.sender@example.com>\n> \tSubject: [PATCH] Fix one bug, add another\n> \tContent-Type: text/plain; charset=us-ascii\n>\n> \tBlah blah blah\n>\n> than one in which the content includes some useless metadata that was\n> already in the header.  So you should just strip the header out from\n> the body before sending.\n>\n> There are three common exceptions: 1) you might want to send a patch\n> written by someone else, 2) you might want to mark a patch as written\n> before it was sent, and 3) some people like to receive patches as\n> attachments rather than inlined in messages.  For the first two cases,\n> the solution is to include the header fields to change in the body:\n>\n> \tFrom: Patch Writer <patch.writer@example.com>\n> \tDate: Wed, 01 Apr 1970 01:23:45 +0100\n>\n> \tBlah blah blah\n> \t---\n> \tHi,\n>\n> \tPatch Writer wrote this patch a while ago that might be\n> \trelevant.  It needed a straightforward one-line change to\n> \tapply and is otherwise unchanged.\n>\n> \tWhat do you think?\n> [...]\n>\n> For the last case, I think it is most common to send unchanged 'git\n> format-patch' output.  But only the From, Date, and Subject fields\n> are actually needed.\n>\n> I am not sure how well 'git am' copes with non-ascii characters in\n> the pseudo-header lines: I would have guessed it could handle them\n> both rfc2047-encoded and not, but I have not tried.\n>\n>> I really would like continuing having the convenience of using a web\n>> access to my gmail for sending the patches, so I just need a way to\n>> format the patches which makes it easy submitting them later. I'd like\n>> to avoid using any other email client for that, if possible.\n>\n> Here, there is another danger: the Gmail web interface does not\n> consider your whitespace precious, so it is very prone to mangling\n> patches (especially with long lines).\n>\n> Documentation/SubmittingPatches [1] has some advice:\n>\n> | Gmail\n> | -----\n> |\n> | GMail does not appear to have any way to turn off line wrapping in the web\n> | interface, so this will mangle any emails that you send.  You can however\n> | use any IMAP email client to connect to the google imap server, and\n> forward\n> | the emails through that.  Just make sure to disable line wrapping in that\n> | email client.  Alternatively, use \"git send-email\" instead.\n> |\n> | Submitting properly formatted patches via Gmail is simple now that\n> | IMAP support is available. First, edit your ~/.gitconfig to specify your\n> | account settings:\n> |\n> | [imap]\n> | \tfolder = \"[Gmail]/Drafts\"\n> | \thost = imaps://imap.gmail.com\n> | \tuser = user@gmail.com\n> | \tpass = p4ssw0rd\n> | \tport = 993\n> | \tsslverify = false\n> |\n> | You might need to instead use: folder = \"[Google Mail]/Drafts\" if you get\n> an error\n> | that the \"Folder doesn't exist\".\n> |\n> | Next, ensure that your Gmail settings are correct. In \"Settings\" the\n> | \"Use Unicode (UTF-8) encoding for outgoing messages\" should be checked.\n> |\n> | Once your commits are ready to send to the mailing list, run the following\n> | command to send the patch emails to your Gmail Drafts folder.\n> |\n> | \t$ git format-patch -M --stdout origin/master | git imap-send\n> |\n> | Go to your Gmail account, open the Drafts folder, find the patch email,\n> fill\n> | in the To: and CC: fields and send away!\n>\n> Good luck.\n>\n> Hope that helps,\n\nHello, Jonatan!\n\n     Thanks for your insights, surely I understand what is reasoning behind it.\n     I expect this thread will be useful to others in the future. Here\ngoes another relevant reference about sending patches using web GUI of\ngmail :\nhttp://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/email-clients.txt;h=a618efab7b156658be70b29c1a6a9b9c4093e0f5;hb=HEAD\n\nThanks a lot,\nAndré\n"},{"id":"126755","messageId":"b8bf37780911040259v94e485s3f5fd33296231d20@mail.gmail.com","threadId":"21464","inReplyTo":"20091104084903.GA1137@coredump.intra.peff.net","subject":"Re: Problem with \"From:\" line on \"git format-patch\" generated patches","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2009-11-04T10:59:25Z","receivedAt":"2009-11-04T10:59:25Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"On 11/4/09, Jeff King <peff@peff.net> wrote:\n> On Tue, Nov 03, 2009 at 04:06:39PM -0200, André Goddard Rosa wrote:\n>\n>> I'm not using any specific tool for inputting the git-format-patch,\n>> but instead I'm sending the files generated by it through gmail as an\n>> inlined patch in the email body.\n>>\n>> I like the convenience of format-patch for generating the patch files,\n>> but in this case, formatting the header as rfc2047 is not necessary\n>> and makes a funny/garbled output in my patch submission.\n>>\n>> Do you have a suggestion for my workflow?\n>\n> I don't think there's currently a way to turn off the rfc2047 from\n> within format-patch. You can generate a single patch with the same\n> format using:\n>\n>   git log -1 -p --stat --summary \\\n>     --pretty=tformat:'From: %an <%ae>%nDate: %aD%nSubject: [PATCH] %s%n%n%b'\n>\n> but it won't do nice things like putting one patch in each file.\n>\n> Probably it would make sense for format-patch to have an option to\n> indicate that you are going to inline these patches into a different\n> MUA. So drop the 'From' mbox header line, don't rfc2047 encode, and\n> maybe some other behaviors. I do the same thing (including inline in\n> mutt), but I just delete the unwanted lines manually, and fortunately my\n> name doesn't contain any non-ascii characters. ;)\n>\n> -Peff\n\nHello, Peff!\n\n     It's good to know that I'm not alone on this. I think that should\nbe fairly easy, yes.\n     Thanks for helping!\n\nThank you all,\nAndré\n"}]}