Using format-patch and apply against files with CRLF line endings

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Using format-patch and apply against files with CRLF line endings

From: Steven E. Harris <hidden>
Date: 2016-06-15 22:51:04

Is it the case that format-patch will always emit text with LF line
endings, or is it respecting whatever the host platform considers to be
the proper line ending? Is the line ending in use configurable?

I ask because I see that git-p4 uses format-patch and apply internally
to apply changes against files in the Perforce workspace, and those
files have CRLF line endings, but it looks like format-patch is emitting
patches with LF line endings, and none of those patches will apply
cleanly.

Perhaps I just need to pipe the output from format-patch through
unix2dos before feeding it to apply, but I'm wondering whether I'm
barking up the wrong tree here.

-- 
Steven E. Harris

Re: Using format-patch and apply against files with CRLF line endings

From: Jay Soffian <hidden>
Date: 2016-06-15 22:51:04

On Wed, Apr 20, 2011 at 7:48 AM, Steven E. Harris [off-list ref] wrote:
Is it the case that format-patch will always emit text with LF line
endings, or is it respecting whatever the host platform considers to be
the proper line ending? Is the line ending in use configurable?

I ask because I see that git-p4 uses format-patch and apply internally
to apply changes against files in the Perforce workspace, and those
files have CRLF line endings, but it looks like format-patch is emitting
patches with LF line endings, and none of those patches will apply
cleanly.

Perhaps I just need to pipe the output from format-patch through
unix2dos before feeding it to apply, but I'm wondering whether I'm
barking up the wrong tree here.
The patch emitted by format-patch should have the correct (original)
line-endings, but to preserve them when the patch is applied, git-am
needs to be called with --keep-cr (also see config option
'am.keepcr').

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