Re: [bug (maybe)] Applying patch with '---'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 1, 2015, 06:20 UTC
- Message-ID
- <xmqqy4mcmkt2.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAFOYHZC6Qd9wkoWPcTJDxAs9u=FGpHQTkjE-guhwkya0DRVA6g@mail.gmail.com>
Chris Packham <judge.packham@gmail.com> writes:
Show 12 quoted lines
> So I was just sent a patch generated with 'git format-patch' that 'git > am' fails to apply correctly. It applies but part of the commit > message is lost. > > The problem is that the commit message has lines like > > --- Foo happened > did some things to handle Foo > --- Bar happened > Still processing update from Foo which led to a crash > > git mailinfo seems to discard everything after the first '--- Blah'.
Yes, this is well known. So is a line that begins with "diff --git" makes mailinfo to guess that it is the end of the log message.
> ... I know git > mailinfo shouldn't handle garbage input but I guess the problem I have > is that the patch was generated by git format-patch ...
Whatever message you write format-patch emits without escaping, so "patch was generated by format-patch" does not guarantee anything, unfortunately. A related similar issue is that a line that begins with "From " may be corrupted into a line that begins with ">From " by the time the message hits your mailbox. These are unfortunately something you have to know and long-time users learned to avoid doing so unconsciously ;-).