git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Carl Worth <cworth@cworth.org>
Cc: git <git@vger.kernel.org>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] format-patch: Properly escape From_ lines when creating an mbox.
Date: Thu, 10 Jun 2010 07:49:34 -0700	[thread overview]
Message-ID: <7vaar3nds1.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <87eiggiy8g.fsf@yoom.home.cworth.org> (Carl Worth's message of "Tue\, 08 Jun 2010 22\:14\:23 -0700")

Carl Worth <cworth@cworth.org> writes:

> On Tue, 08 Jun 2010 20:50:01 -0700, Junio C Hamano <gitster@pobox.com> wrote:
>> Carl Worth <cworth@cworth.org> writes:
>> Especially because your implementation quotes lines that begin with "From "
>> unconditionally (even when the tail end of the line would never be a
>> valid-looking timestamp).  Such an output will confuse existing mailsplit,
>> but the worst part of the story is that somebody who is applying a series
>> of patches will _not_ notice the breakage.  The payload of the second and
>> subsequent messages will likely be concatenated as if it were part of the
>> first message, ignoring cruft between patches, but the resulting tree
>> would likely to be the same as what the sending end intended.

Please disregard the above; I wasn't thinking straight.

If your format-patch quotes ">*From " in the log message, and you unquote
it somewhere in mailsplit to mailinfo pipeline, then the only time any
funny interaction between the current git and your git would happen is
when your git formats a commit with a line in its log that begins with
"From " that cannot be a mistaken as a UNIX-From line and you use "am"
from the current git on the output; the resulting commit would get an
extra ">" left in the message, but that is a small price to pay.  There is
no other downside I can see (and the upside is that the output from your
format-patch won't be split incorrectly, of course).

I find that the change to format-patch not to emit the UNIX-From line when
generating one file per commit is somewhat iffy.  An upside is that the
existing mailsplit-mailinfo pipeline already knows not to split such an
input, so the change makes

    git format-patch <revspec> |
    while read path
    do
        git am $path || break
    done

(which is essentially what an old rebase did) do the right thing, even in
the presense of a confusing "From " in the log message.

That change however is not without downsides.  You may potentially be
breaking people's existing scripts in various ways.  They may be relying
on the presense of the line by:

 - using it to pick up the original commit object name from, just like
   "rebase" does;

 - using it as the "magic" number to protect them from being fed a bad
   input;

 - stripping the first line unconditionally, assuming it is that UNIX-From
   line they shouldn't cut and paste into the MUA.

It is nice at the conceptual level, though.  By declaring individual file
RFC2822 message (not mbox), it makes it very clear that it is MUA's
responsibility to quote "From " in the payload when the output is used by
MUA to compose and send a message.  IOW, we shouldn't be doing the quote
in our output when operating in that mode.

Thanks.

  parent reply	other threads:[~2010-06-10 14:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  1:01 [PATCH] format-patch: Properly escape From_ lines when creating an mbox Carl Worth
2010-06-09  3:50 ` Junio C Hamano
2010-06-09  5:14   ` Carl Worth
2010-06-09 16:56     ` Carl Worth
2010-06-10 14:49     ` Junio C Hamano [this message]
2010-06-10 15:31       ` Carl Worth
2010-06-10 15:52         ` Carl Worth
2010-06-10 16:12           ` Junio C Hamano
2010-06-10 16:30             ` Carl Worth
2010-06-09  5:48   ` H. Peter Anvin
2010-06-09  7:04     ` Carl Worth

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=7vaar3nds1.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    --cc=hpa@zytor.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).