{"thread":{"id":"27146","subject":"Using format-patch and apply against files with CRLF line endings","startedAt":"2011-04-20T11:48:02Z","lastAt":"2011-04-20T15:59:45Z","messageCount":2,"participants":["Steven E. Harris","Jay Soffian"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"166147","messageId":"m2tydt5ekt.fsf@Spindle.sehlabs.com","threadId":"27146","inReplyTo":null,"subject":"Using format-patch and apply against files with CRLF line endings","fromName":"Steven E. Harris","fromEmail":"seh@panix.com","sentAt":"2011-04-20T11:48:02Z","receivedAt":"2011-04-20T11:48:02Z","isPatch":false,"sender":{"key":"seh@panix.com","avatar":"https://gravatar.com/avatar/d59ec0f7c010ee73cd67db381a5b865206fed17fd4278f12cdb6277db30033fc?d=mp&s=160"},"body":"Is it the case that format-patch will always emit text with LF line\nendings, or is it respecting whatever the host platform considers to be\nthe proper line ending? Is the line ending in use configurable?\n\nI ask because I see that git-p4 uses format-patch and apply internally\nto apply changes against files in the Perforce workspace, and those\nfiles have CRLF line endings, but it looks like format-patch is emitting\npatches with LF line endings, and none of those patches will apply\ncleanly.\n\nPerhaps I just need to pipe the output from format-patch through\nunix2dos before feeding it to apply, but I'm wondering whether I'm\nbarking up the wrong tree here.\n\n-- \nSteven E. Harris\n"},{"id":"166155","messageId":"BANLkTi=xNrtbwcDCHriGZ6VpxHhTfVNptA@mail.gmail.com","threadId":"27146","inReplyTo":"m2tydt5ekt.fsf@Spindle.sehlabs.com","subject":"Re: Using format-patch and apply against files with CRLF line endings","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-04-20T15:59:45Z","receivedAt":"2011-04-20T15:59:45Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Apr 20, 2011 at 7:48 AM, Steven E. Harris <seh@panix.com> wrote:\n> Is it the case that format-patch will always emit text with LF line\n> endings, or is it respecting whatever the host platform considers to be\n> the proper line ending? Is the line ending in use configurable?\n>\n> I ask because I see that git-p4 uses format-patch and apply internally\n> to apply changes against files in the Perforce workspace, and those\n> files have CRLF line endings, but it looks like format-patch is emitting\n> patches with LF line endings, and none of those patches will apply\n> cleanly.\n>\n> Perhaps I just need to pipe the output from format-patch through\n> unix2dos before feeding it to apply, but I'm wondering whether I'm\n> barking up the wrong tree here.\n\nThe patch emitted by format-patch should have the correct (original)\nline-endings, but to preserve them when the patch is applied, git-am\nneeds to be called with --keep-cr (also see config option\n'am.keepcr').\n\nj.\n"}]}