{"thread":{"id":"31928","subject":"[PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","startedAt":"2012-10-24T08:03:35Z","lastAt":"2012-10-25T11:21:06Z","messageCount":12,"participants":["Krzysztof Mazur","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"201799","messageId":"1351065815-22416-1-git-send-email-krzysiek@podlesie.net","threadId":"31928","inReplyTo":null,"subject":"[PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-24T08:03:35Z","receivedAt":"2012-10-24T08:03:35Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"The git-send-email always use RFC2047 subject quoting for files\nwith \"broken\" encoding - non-ASCII files without Content-Transfer-Encoding,\neven for ASCII subjects. Now for ASCII subjects the RFC2047 quoting will be\nskipped.\n\nSigned-off-by: Krzysztof Mazur <krzysiek@podlesie.net>\n---\n git-send-email.perl   |  3 ++-\n t/t9001-send-email.sh | 17 +++++++++++++++++\n 2 files changed, 19 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex adcb4e3..efeae4c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1327,7 +1327,8 @@ foreach my $t (@files) {\n \t\t$body_encoding = $auto_8bit_encoding;\n \t}\n \n-\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n+\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n+\t\t\t($subject =~ /[^[:ascii:]]/)) {\n \t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n \t}\n \ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 89fceda..6c6af7d 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1143,6 +1143,23 @@ EOF\n '\n \n test_expect_success $PREREQ 'setup expect' '\n+cat >expected <<EOF\n+Subject: subject goes here\n+EOF\n+'\n+\n+test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '\n+\tclean_fake_sendmail &&\n+\techo bogus |\n+\tgit send-email --from=author@example.com --to=nobody@example.com \\\n+\t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t\t--8bit-encoding=UTF-8 \\\n+\t\t\temail-using-8bit >stdout &&\n+\tgrep \"Subject\" msgtxt1 >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success $PREREQ 'setup expect' '\n cat >content-type-decl <<EOF\n MIME-Version: 1.0\n Content-Type: text/plain; charset=UTF-8\n-- \n1.8.0.3.gf4c35fc\n"},{"id":"201802","messageId":"20121024084636.GA23500@sigill.intra.peff.net","threadId":"31928","inReplyTo":"1351065815-22416-1-git-send-email-krzysiek@podlesie.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-24T08:46:36Z","receivedAt":"2012-10-24T08:46:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 24, 2012 at 10:03:35AM +0200, Krzysztof Mazur wrote:\n\n> The git-send-email always use RFC2047 subject quoting for files\n> with \"broken\" encoding - non-ASCII files without Content-Transfer-Encoding,\n> even for ASCII subjects. Now for ASCII subjects the RFC2047 quoting will be\n> skipped.\n> [...]\n> -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n> +\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> +\t\t\t($subject =~ /[^[:ascii:]]/)) {\n\nIs that test sufficient? We would also need to encode if it has rfc2047\nspecials, no?\n\nIt looks like we use the same regex elsewhere. Maybe this would be a\ngood chance to abstract out a needs_rfc2047_quoting while we are in the\narea?\n\nOther than that, I did not see anything wrong with the patch.\n\n-Peff\n"},{"id":"201812","messageId":"20121024171036.GA18880@shrek.podlesie.net","threadId":"31928","inReplyTo":"20121024084636.GA23500@sigill.intra.peff.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-24T17:10:36Z","receivedAt":"2012-10-24T17:10:36Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"On Wed, Oct 24, 2012 at 04:46:36AM -0400, Jeff King wrote:\n> On Wed, Oct 24, 2012 at 10:03:35AM +0200, Krzysztof Mazur wrote:\n> \n> > The git-send-email always use RFC2047 subject quoting for files\n> > with \"broken\" encoding - non-ASCII files without Content-Transfer-Encoding,\n> > even for ASCII subjects. Now for ASCII subjects the RFC2047 quoting will be\n> > skipped.\n> > [...]\n> > -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n> > +\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> > +\t\t\t($subject =~ /[^[:ascii:]]/)) {\n> \n> Is that test sufficient? We would also need to encode if it has rfc2047\n> specials, no?\n\nFor Subject this should be sufficient. According to RFC822 after\n\"Subject:\" we have \"text\" token,\n\n--- from RFC822 ---\n                 /  \"Subject\"           \":\"  *text\n--- from RFC822 ---\n\nand text is defined as:\n\n--- from RFC822 ---\n     text        =  <any CHAR, including bare    ; => atoms, specials,\n                     CR & bare LF, but NOT       ;  comments and\n                     including CRLF>             ;  quoted-strings are\n                                                 ;  NOT recognized.\n--- from RFC822 ---\n\nso only CRLF is not allowed in Subject.\n\n\nSo the problem only exists for broken RFC2047-like texts, but I think\nit's ok to just pass such subjects, in most cases the Subject comes\nfrom already formatted patch file. I think that we just want to fix Subjects\nwithout specified encoding here.\n\n\nIn most cases, when git-send-email is used for patches generated\nby \"git format-patch\" we just don't want to corrupt Subject. The\n\"git format-patch\" generates \"broken\" patches when commit message\nuses only ASCII characters and patch contains some non-ASCII characters.\nIn this case original git-send-email, without this patch, adds RFC2047\nquotation for pure ASCII Subject.\n\n> \n> It looks like we use the same regex elsewhere. Maybe this would be a\n> good chance to abstract out a needs_rfc2047_quoting while we are in the\n> area?\n\nIt's a good idea, however rules are different for Subject and addresses\n(sanitize_address).\n\nI think we can go even further, we can just add quote_subject(),\nwhich performs this test and calls quote_rfc2047() if necessary.\nI'm sending bellow patch that does that.\n\nKrzysiek\n-- \nFrom a1e6eef831275485ec1555d94ff0d9aac852dd12 Mon Sep 17 00:00:00 2001\nFrom: Krzysztof Mazur <krzysiek@podlesie.net>\nDate: Wed, 24 Oct 2012 19:08:57 +0200\nSubject: [PATCH] git-send-email: introduce quote_subject()\n\nThe quote_rfc2047() always adds RFC2047 quoting and to avoid quoting ASCII\nsubjects, before calling quote_rfc2047() subject must be tested for non-ASCII\ncharacters. To avoid this new quote_subject() function is introduced.\nThe quote_subject() performs this test and calls quote_rfc2047() only if\nnecessary.\n\nSigned-off-by: Krzysztof Mazur <krzysiek@podlesie.net>\n---\n git-send-email.perl | 25 +++++++++++++++++++------\n 1 file changed, 19 insertions(+), 6 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex efeae4c..e9aec8d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -657,9 +657,7 @@ EOT\n \t\t\t$initial_subject = $1;\n \t\t\tmy $subject = $initial_subject;\n \t\t\t$_ = \"Subject: \" .\n-\t\t\t\t($subject =~ /[^[:ascii:]]/ ?\n-\t\t\t\t quote_rfc2047($subject, $compose_encoding) :\n-\t\t\t\t $subject) .\n+\t\t\t\tquote_subject($subject, $compose_encoding) .\n \t\t\t\t\"\\n\";\n \t\t} elsif (/^In-Reply-To:\\s*(.+)\\s*$/i) {\n \t\t\t$initial_reply_to = $1;\n@@ -907,6 +905,22 @@ sub is_rfc2047_quoted {\n \t$s =~ m/^(?:\"[[:ascii:]]*\"|=\\?$token\\?$token\\?$encoded_text\\?=)$/o;\n }\n \n+sub subject_needs_rfc2047_quoting {\n+\tmy $s = shift;\n+\n+\treturn !is_rfc2047_quoted($s) && ($s =~ /[^[:ascii:]]/);\n+}\n+\n+sub quote_subject {\n+ \tlocal $subject = shift;\n+ \tmy $encoding = shift || 'UTF-8';\n+\n+ \tif (subject_needs_rfc2047_quoting($subject)) {\n+\t\treturn quote_rfc2047($subject, $encoding);\n+ \t}\n+ \treturn $subject;\n+}\n+\n # use the simplest quoting being able to handle the recipient\n sub sanitize_address {\n \tmy ($recipient) = @_;\n@@ -1327,9 +1341,8 @@ foreach my $t (@files) {\n \t\t$body_encoding = $auto_8bit_encoding;\n \t}\n \n-\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n-\t\t\t($subject =~ /[^[:ascii:]]/)) {\n-\t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n+\tif ($broken_encoding{$t}) {\n+\t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n \t}\n \n \tif (defined $author and $author ne $sender) {\n-- \n1.8.0.3.gf4c35fc\n"},{"id":"201824","messageId":"20121024192530.GA26477@sigill.intra.peff.net","threadId":"31928","inReplyTo":"20121024171036.GA18880@shrek.podlesie.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-24T19:25:30Z","receivedAt":"2012-10-24T19:25:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 24, 2012 at 07:10:36PM +0200, Krzysztof Mazur wrote:\n\n> > > -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n> > > +\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> > > +\t\t\t($subject =~ /[^[:ascii:]]/)) {\n> > \n> > Is that test sufficient? We would also need to encode if it has rfc2047\n> > specials, no?\n> \n> For Subject this should be sufficient. According to RFC822 after\n> \"Subject:\" we have \"text\" token,\n> [...]\n> So the problem only exists for broken RFC2047-like texts, but I think\n> it's ok to just pass such subjects, in most cases the Subject comes\n> from already formatted patch file. I think that we just want to fix Subjects\n> without specified encoding here.\n\nRight, but I was specifically worried about raw \"=?\", which is only an\nissue due to rfc2047 itself.\n\nHowever, reading the patch again, we are already checking for that with\nis_rfc2047_quoted. It might miss the case where we have =? but not the\nrest of a valid encoded word, but any compliant parser should recognize\nthat and leave it be.\n\nSo I think your original patch is actually correct.\n\n> I think we can go even further, we can just add quote_subject(),\n> which performs this test and calls quote_rfc2047() if necessary.\n> I'm sending bellow patch that does that.\n\nYeah, it would still be nice to keep the logic in one place.\n\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index efeae4c..e9aec8d 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -657,9 +657,7 @@ EOT\n>  \t\t\t$initial_subject = $1;\n>  \t\t\tmy $subject = $initial_subject;\n>  \t\t\t$_ = \"Subject: \" .\n> -\t\t\t\t($subject =~ /[^[:ascii:]]/ ?\n> -\t\t\t\t quote_rfc2047($subject, $compose_encoding) :\n> -\t\t\t\t $subject) .\n> +\t\t\t\tquote_subject($subject, $compose_encoding) .\n\nHrm. Isn't this one technically a regression if the $subject contains\nencoded words? IOW, in this case we feed quote_subject a known-raw\nheader; any rfc2047 in it would want to be encoded to be preserved.\n\nBut in this case:\n\n> @@ -1327,9 +1341,8 @@ foreach my $t (@files) {\n>  \t\t$body_encoding = $auto_8bit_encoding;\n>  \t}\n>  \n> -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> -\t\t\t($subject =~ /[^[:ascii:]]/)) {\n> -\t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n> +\tif ($broken_encoding{$t}) {\n> +\t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n>  \t}\n\nWe have a possibly already-encoded header, and we would want to avoid\ndouble-encoding it.\n\nIn the first case, the \"wants quoting\" logic should be:\n\n  is_rfc2047_quoted($subject) || /[^[:ascii:]]/\n\nand in the latter case it would be:\n\n  !is_rfc2047_quoted($subject) && /^[:ascii:]]/\n\n-Peff\n"},{"id":"201826","messageId":"20121024210826.GA23562@shrek.podlesie.net","threadId":"31928","inReplyTo":"20121024192530.GA26477@sigill.intra.peff.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-24T21:08:26Z","receivedAt":"2012-10-24T21:08:26Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"On Wed, Oct 24, 2012 at 03:25:30PM -0400, Jeff King wrote:\n> Right, but I was specifically worried about raw \"=?\", which is only an\n> issue due to rfc2047 itself.\n> \n> However, reading the patch again, we are already checking for that with\n> is_rfc2047_quoted. It might miss the case where we have =? but not the\n> rest of a valid encoded word, but any compliant parser should recognize\n> that and leave it be.\n> \n> So I think your original patch is actually correct.\n> \n> [...]\n> We have a possibly already-encoded header, and we would want to avoid\n> double-encoding it.\n> \n> In the first case, the \"wants quoting\" logic should be:\n> \n>   is_rfc2047_quoted($subject) || /[^[:ascii:]]/\n> \n> and in the latter case it would be:\n> \n>   !is_rfc2047_quoted($subject) && /^[:ascii:]]/\n> \n\nok, I'm sending a version that just adds quote_subject() without\nchanging any logic, so now we still have in first case:\n\n /[^[:ascii:]]/\n\nand in the latter case:\n \n !is_rfc2047_quoted($subject) && /^[:ascii:]]/\n\n\nIn the next patch I will just add matching for \"=?\" in \nsubject_needs_rfc2047_quoting() and we will have:\n\n   /=?/ || /[^[:ascii:]]/\n\nand in the latter case:\n \n   !is_rfc2047_quoted($subject) && (/=\\?/ || /^[:ascii:]]/)\n\nThis will also add quoting for any rfc2047 quoted subject or any\nother rfc2047-like subject, as you suggested.\n\nKrzysiek\n-- \nFrom a70c5385f9b4da69a8ce00a1448f87f63bbd500d Mon Sep 17 00:00:00 2001\nFrom: Krzysztof Mazur <krzysiek@podlesie.net>\nDate: Wed, 24 Oct 2012 22:46:00 +0200\nSubject: [PATCH] git-send-email: introduce quote_subject()\n\nThe quote_rfc2047() always adds RFC2047 quoting and to avoid quoting ASCII\nsubjects, before calling quote_rfc2047() subject must be tested for non-ASCII\ncharacters. To avoid this new quote_subject() function is introduced.\nThe quote_subject() performs this test and calls quote_rfc2047() only if\nnecessary.\n\nSigned-off-by: Krzysztof Mazur <krzysiek@podlesie.net>\n---\n git-send-email.perl | 25 +++++++++++++++++++------\n 1 file changed, 19 insertions(+), 6 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex efeae4c..eb1b876 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -657,9 +657,7 @@ EOT\n \t\t\t$initial_subject = $1;\n \t\t\tmy $subject = $initial_subject;\n \t\t\t$_ = \"Subject: \" .\n-\t\t\t\t($subject =~ /[^[:ascii:]]/ ?\n-\t\t\t\t quote_rfc2047($subject, $compose_encoding) :\n-\t\t\t\t $subject) .\n+\t\t\t\tquote_subject($subject, $compose_encoding) .\n \t\t\t\t\"\\n\";\n \t\t} elsif (/^In-Reply-To:\\s*(.+)\\s*$/i) {\n \t\t\t$initial_reply_to = $1;\n@@ -907,6 +905,22 @@ sub is_rfc2047_quoted {\n \t$s =~ m/^(?:\"[[:ascii:]]*\"|=\\?$token\\?$token\\?$encoded_text\\?=)$/o;\n }\n \n+sub subject_needs_rfc2047_quoting {\n+\tmy $s = shift;\n+\n+\treturn ($s =~ /[^[:ascii:]]/);\n+}\n+\n+sub quote_subject {\n+ \tlocal $subject = shift;\n+ \tmy $encoding = shift || 'UTF-8';\n+\n+ \tif (subject_needs_rfc2047_quoting($subject)) {\n+\t\treturn quote_rfc2047($subject, $encoding);\n+ \t}\n+ \treturn $subject;\n+}\n+\n # use the simplest quoting being able to handle the recipient\n sub sanitize_address {\n \tmy ($recipient) = @_;\n@@ -1327,9 +1341,8 @@ foreach my $t (@files) {\n \t\t$body_encoding = $auto_8bit_encoding;\n \t}\n \n-\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n-\t\t\t($subject =~ /[^[:ascii:]]/)) {\n-\t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n+\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n+\t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n \t}\n \n \tif (defined $author and $author ne $sender) {\n-- \n1.8.0.4.ge8ddce6\n"},{"id":"201827","messageId":"1351114109-16310-1-git-send-email-krzysiek@podlesie.net","threadId":"31928","inReplyTo":"20121024210826.GA23562@shrek.podlesie.net","subject":"[PATCH] git-send-email: add rfc2047 quoting for \"=?\"","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-24T21:28:29Z","receivedAt":"2012-10-24T21:28:29Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"For raw subjects rfc2047 quoting is needed not only for non-ASCII characters,\nbut also for any possible rfc2047 in it.\n\nSigned-off-by: Krzysztof Mazur <krzysiek@podlesie.net>\n---\nOops, this ugly Subject was generated by git format-patch (both 1.8.0\nand km/send-email-compose-encoding).\n\n git-send-email.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex eb1b876..cfd20fa 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -908,7 +908,7 @@ sub is_rfc2047_quoted {\n sub subject_needs_rfc2047_quoting {\n \tmy $s = shift;\n \n-\treturn ($s =~ /[^[:ascii:]]/);\n+\treturn ($s =~ /[^[:ascii:]]/) || ($s =~ /=\\?/);\n }\n \n sub quote_subject {\n-- \n1.8.0.rc0.30.g72615bf\n"},{"id":"201870","messageId":"20121025090149.GC8390@sigill.intra.peff.net","threadId":"31928","inReplyTo":"20121024210826.GA23562@shrek.podlesie.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-25T09:01:49Z","receivedAt":"2012-10-25T09:01:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 24, 2012 at 11:08:26PM +0200, Krzysztof Mazur wrote:\n\n> ok, I'm sending a version that just adds quote_subject() without\n> changing any logic, so now we still have in first case:\n> \n>  /[^[:ascii:]]/\n> \n> and in the latter case:\n>  \n>  !is_rfc2047_quoted($subject) && /^[:ascii:]]/\n> \n> \n> In the next patch I will just add matching for \"=?\" in \n> subject_needs_rfc2047_quoting() and we will have:\n> \n>    /=?/ || /[^[:ascii:]]/\n> \n> and in the latter case:\n>  \n>    !is_rfc2047_quoted($subject) && (/=\\?/ || /^[:ascii:]]/)\n> \n> This will also add quoting for any rfc2047 quoted subject or any\n> other rfc2047-like subject, as you suggested.\n\nThanks, the two-patch series you outline makes a lot of sense to me.\n\n> Krzysiek\n> -- \n> From a70c5385f9b4da69a8ce00a1448f87f63bbd500d Mon Sep 17 00:00:00 2001\n> From: Krzysztof Mazur <krzysiek@podlesie.net>\n> Date: Wed, 24 Oct 2012 22:46:00 +0200\n> Subject: [PATCH] git-send-email: introduce quote_subject()\n\nWhen sending a patch following some cover letter material, please cut\nout any non-essential headers and use the scissors symbol, like this:\n\n  -- >8 --\n  Subject: [PATCH] this subject overrides the whole email's subject\n\n  the regular body and diff go here...\n\nThat format is understood by \"git am\" and means I do not have to\nmanually munge it, which saves a little work.\n\n> +sub quote_subject {\n> + \tlocal $subject = shift;\n> + \tmy $encoding = shift || 'UTF-8';\n> +\n> + \tif (subject_needs_rfc2047_quoting($subject)) {\n> +\t\treturn quote_rfc2047($subject, $encoding);\n> + \t}\n> + \treturn $subject;\n> +}\n\nThere is some funny whitespace here (space followed by tab).\n\n> -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> -\t\t\t($subject =~ /[^[:ascii:]]/)) {\n> -\t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n> +\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n> +\t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n>  \t}\n\nHmm. What is this patch on top of? It looks like it is on top of your\noriginal patch, but when I tried it on top of that, it does not apply\neither, and the index lines in the patch do not mention a sha1 that I do\nnot have.\n\nDo you mind re-rolling a final 2-patch series with:\n\n  1. Your original patch and this one squashed together, with an\n     appropriate commit message.\n\n  2. The second \"quote when we see '=?'\" patch.\n\nThanks.\n\n-Peff\n"},{"id":"201871","messageId":"20121025090521.GD8390@sigill.intra.peff.net","threadId":"31928","inReplyTo":"1351114109-16310-1-git-send-email-krzysiek@podlesie.net","subject":"Re: [PATCH] git-send-email: add rfc2047 quoting for \"=?\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-25T09:05:21Z","receivedAt":"2012-10-25T09:05:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 24, 2012 at 11:28:29PM +0200, Krzysztof Mazur wrote:\n\n> For raw subjects rfc2047 quoting is needed not only for non-ASCII characters,\n> but also for any possible rfc2047 in it.\n> [...]\n> -\treturn ($s =~ /[^[:ascii:]]/);\n> +\treturn ($s =~ /[^[:ascii:]]/) || ($s =~ /=\\?/);\n\nVery nice and obvious bug-fix made easy by the previous refactoring. :)\n\n> ---\n> Oops, this ugly Subject was generated by git format-patch (both 1.8.0\n> and km/send-email-compose-encoding).\n\nYeah, format-patch has the same behavior (to encode when we see \"=?\").\nSo we know it is working. It is perhaps overkill in this case, since\nthere is not technically a valid encoded-word, and a smart parser would\nbe able to see that it should leave it alone. But it is probably better\nto be slightly conservative in what we generate (and the \"=?\" token is\nunlikely to come up in day-to-day usage).\n\n-Peff\n"},{"id":"201883","messageId":"20121025100854.GN8390@sigill.intra.peff.net","threadId":"31928","inReplyTo":"20121025090149.GC8390@sigill.intra.peff.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-25T10:08:54Z","receivedAt":"2012-10-25T10:08:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2012 at 05:01:49AM -0400, Jeff King wrote:\n\n> > -\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&\n> > -\t\t\t($subject =~ /[^[:ascii:]]/)) {\n> > -\t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n> > +\tif ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {\n> > +\t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n> >  \t}\n> \n> Hmm. What is this patch on top of? It looks like it is on top of your\n> original patch, but when I tried it on top of that, it does not apply\n> either, and the index lines in the patch do not mention a sha1 that I do\n> not have.\n>\n> Do you mind re-rolling a final 2-patch series with:\n\nAh, never mind. I missed your earlier \"use compose-encoding for\nSubject\". I've queued it and all of the follow-ons onto the\nkm/send-email-compose-encoding topic.\n\nThanks.\n\n-Peff\n"},{"id":"201893","messageId":"20121025111217.GA3688@shrek.podlesie.net","threadId":"31928","inReplyTo":"20121025090149.GC8390@sigill.intra.peff.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-25T11:12:17Z","receivedAt":"2012-10-25T11:12:17Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"On Thu, Oct 25, 2012 at 05:01:49AM -0400, Jeff King wrote:\n> \n> Hmm. What is this patch on top of? It looks like it is on top of your\n> original patch, but when I tried it on top of that, it does not apply\n> either, and the index lines in the patch do not mention a sha1 that I do\n> not have.\n\nSorry, it's against km/send-email-compose-encoding (or current next)\n+ \"git-send-email: use compose-encoding for Subject\".\n\n> \n> Do you mind re-rolling a final 2-patch series with:\n> \n>   1. Your original patch and this one squashed together, with an\n>      appropriate commit message.\n\nI think that it's better to do refactoring and fix for ASCII in separate\npatches. Maybe we should reverse order of first two patches. This first\nwill do refactoring and the second will just replace quote_rfc2047()\nwith quote_subject() in \"broken\" encoding case and add test\nfor this problem.\n\n> \n>   2. The second \"quote when we see '=?'\" patch.\n> \n> Thanks.\n> \n> -Peff\n\nok, I will resend the final series.\n\nI need also to fix \"git-send-email: use compose-encoding for Subject\"\npatch. Now it's depends both on this series and\nkm/send-email-compose-encoding branch.\n\nKrzysiek\n"},{"id":"201895","messageId":"20121025111919.GA25272@shrek.podlesie.net","threadId":"31928","inReplyTo":"20121025100854.GN8390@sigill.intra.peff.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-25T11:19:19Z","receivedAt":"2012-10-25T11:19:19Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"On Thu, Oct 25, 2012 at 06:08:54AM -0400, Jeff King wrote:\n> \n> Ah, never mind. I missed your earlier \"use compose-encoding for\n> Subject\". I've queued it and all of the follow-ons onto the\n> km/send-email-compose-encoding topic.\n> \n\nthanks, what about the problem with whitespaces in \"quote_subject\" patch?\n\nKrzysiek\n"},{"id":"201894","messageId":"20121025112106.GA25088@sigill.intra.peff.net","threadId":"31928","inReplyTo":"20121025111919.GA25272@shrek.podlesie.net","subject":"Re: [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-25T11:21:06Z","receivedAt":"2012-10-25T11:21:06Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2012 at 01:19:19PM +0200, Krzysztof Mazur wrote:\n\n> On Thu, Oct 25, 2012 at 06:08:54AM -0400, Jeff King wrote:\n> > \n> > Ah, never mind. I missed your earlier \"use compose-encoding for\n> > Subject\". I've queued it and all of the follow-ons onto the\n> > km/send-email-compose-encoding topic.\n> > \n> \n> thanks, what about the problem with whitespaces in \"quote_subject\" patch?\n\nI fixed the whitespace problems, and just applying your patches in\nsequence on top of send-email-compose-encoding actually looks sensible\n(after looking at it, I came to the same conclusion as you that the two\npatches should be kept separate). I'll push out the results of tonight's\nwork in a few minutes, if you want to eyeball what's in pu.\n\n-Peff\n"}]}