git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: xzer <xiaozhu@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 3/3] format-patch: rfc2047-encode newlines in headers
Date: Thu, 24 Feb 2011 02:15:35 -0500	[thread overview]
Message-ID: <20110224071534.GC16550@sigill.intra.peff.net> (raw)
In-Reply-To: <7vhbbu7792.fsf@alter.siamese.dyndns.org>

On Wed, Feb 23, 2011 at 01:47:53PM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > These should generally never happen, as we already
> > concatenate multiples in subjects into a single line. But
> > let's be defensive, since not encoding them means we will
> > output malformed headers.
> 
> In this particular case, wouldn't it be more conservative and defensive to
> produce malformed headers so that the patch won't leave the
> originator?

No. If you go back to xzer's original mail, the malformed headers didn't
cause messages not to be sent. They just resulted in corrupted and
missing data on the receiver side. I don't think we can rely on any MUA
or MTA having a particular behavior for malformed mail. Some of them may
complain, but many won't.

> I have a suspicion that mailinfo would choke on the output of this
> one, even though I didn't try.

Actually, it does quite well. Without "-k", mailinfo turns it into a
single line, which is what I would expect. With "-k", the info file
contains:

  Author: Jeff King
  Email: peff@peff.net
  Subject: this is a long
  Subject: subject line with
  Subject: many lines in it
  Date: Wed, 23 Feb 2011 11:30:43 -0500

which "git am" turns back into the original multi-line subject.

So I think it's definitely the right thing to do. Not only does it avoid
us generating malformed mail, but because existing mailinfo handles it
sanely, it makes it easy to do a "preserve-newlines" patch on top (which
I'm still not sure is a great idea, but I can see the use in certain
circumstances).

-Peff

  reply	other threads:[~2011-02-24  7:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  8:09 [PATCH] generate a valid rfc2047 mail header for multi-line subject xzer
2011-02-22 20:43 ` Junio C Hamano
2011-02-23  8:08   ` Jeff King
2011-02-23  9:48     ` Jeff King
2011-02-23  9:50       ` [PATCH 1/3] strbuf: add fixed-length version of add_wrapped_text Jeff King
2011-02-23  9:58       ` [PATCH 2/3] format-patch: wrap long header lines Jeff King
2011-02-23  9:59       ` [PATCH 3/3] format-patch: rfc2047-encode newlines in headers Jeff King
2011-02-23 21:47         ` Junio C Hamano
2011-02-24  7:15           ` Jeff King [this message]
2011-02-23 15:16       ` [PATCH] generate a valid rfc2047 mail header for multi-line subject xzer
2011-02-23 16:35         ` Jeff King
2011-02-23 17:34     ` Junio C Hamano
2011-02-24  7:34       ` Jeff King
2011-02-23 15:34   ` xzer
2011-02-23 17:45     ` Junio C Hamano

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=20110224071534.GC16550@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=xiaozhu@gmail.com \
    /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).