Thread (1 message) 1 message, 1 author, 2021-01-13

Re: git am fails because of weird text in commit log

From: Junio C Hamano <hidden>
Date: 2021-01-13 20:34:05

"Michael S. Tsirkin" [off-list ref] writes:
So someone sends me a patch with --- in the commit log, like this below.
Result: git am gets confused and can't apply the patch.
Quite understandable.
Shouldn't git format-patch at least complain about commit log
like this, if not mangle it in some way?
It probably is too early to warn, mangle or quote in "git commit".
I agree with you that "git format-patch" would be the best step in a
typical workflow to warn, mangle or quote.

The solution would probably begin with identifying the lines in the
commit log that mailinfo.c::patchbreak() considers the beginning of
the patch part.  After finding such a line:

 - Warning is easy.  

 - Mangling the line by prefixing something like " " in front of it
   would also be easy.

 - Quoting thru to the end of "patch that shouldn't have been there"
   in possibly a reversible way is probably too hard.

Mangling or quoting should be hidden behind an option, I would
think.

Patches welcome.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help