{"action":"created","issue":{"url":"https://api.github.com/repos/red-gate/ngit/issues/7","labels_url":"https://api.github.com/repos/red-gate/ngit/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/red-gate/ngit/issues/7/comments","events_url":"https://api.github.com/repos/red-gate/ngit/issues/7/events","html_url":"https://github.com/red-gate/ngit/pull/7","id":122122786,"number":7,"title":"Take newlines from patch when creating a file","user":{"login":"GrahamTheCoder","id":2490482,"avatar_url":"https://avatars.githubusercontent.com/u/2490482?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamTheCoder","html_url":"https://github.com/GrahamTheCoder","followers_url":"https://api.github.com/users/GrahamTheCoder/followers","following_url":"https://api.github.com/users/GrahamTheCoder/following{/other_user}","gists_url":"https://api.github.com/users/GrahamTheCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamTheCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamTheCoder/subscriptions","organizations_url":"https://api.github.com/users/GrahamTheCoder/orgs","repos_url":"https://api.github.com/users/GrahamTheCoder/repos","events_url":"https://api.github.com/users/GrahamTheCoder/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamTheCoder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"tomcsmith1990","id":7862582,"avatar_url":"https://avatars.githubusercontent.com/u/7862582?v=3","gravatar_id":"","url":"https://api.github.com/users/tomcsmith1990","html_url":"https://github.com/tomcsmith1990","followers_url":"https://api.github.com/users/tomcsmith1990/followers","following_url":"https://api.github.com/users/tomcsmith1990/following{/other_user}","gists_url":"https://api.github.com/users/tomcsmith1990/gists{/gist_id}","starred_url":"https://api.github.com/users/tomcsmith1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomcsmith1990/subscriptions","organizations_url":"https://api.github.com/users/tomcsmith1990/orgs","repos_url":"https://api.github.com/users/tomcsmith1990/repos","events_url":"https://api.github.com/users/tomcsmith1990/events{/privacy}","received_events_url":"https://api.github.com/users/tomcsmith1990/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-12-14T20:20:24Z","updated_at":"2015-12-14T20:36:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/red-gate/ngit/pulls/7","html_url":"https://github.com/red-gate/ngit/pull/7","diff_url":"https://github.com/red-gate/ngit/pull/7.diff","patch_url":"https://github.com/red-gate/ngit/pull/7.patch"},"body":"We're comitting patches to a Git repo, so when a patch creates a file, if the repo was:\r\n* As-is:\r\n * I haven't tested whether newlines ever get written out correctly in the diff output, but suspect they do. In which case the newlines in the patch would propagate to the created file.\r\n* Change all to CRLF:\r\n  * Everything is the same, so the patch will have the same line endings as other files, so propagating the patch's line endings is the correct thing to do\r\n* Change all to LF: \r\n  *  As above, but the drifted target is scripted out by us with CRLFs, this could plausibly cause an issue when rebasing LF files on to it.\r\n* Custom where patches are treated differently to sql files (e.g. LFs for patches only): \r\n  * The file will end up with LFs, the next partial patch to be applied will take this into account.\r\n  * Applying the patch from the open block will flip all line endings to CRLF. Rebasing it would go badly, but luckily we never do that.\r\n  * The drifted target is scripted out by us with CRLFs, this could plausibly cause an issue when rebasing LF files on to it.\r\n\r\nI think this will be good enough for now, but if https://github.com/libgit2/libgit2/pull/3223 is not complete by the time it causes issues we might consider adding some manual override and injecting knowledge of which line ending to use higher up.\r\n\r\n`DeploymentScriptOptimizationTests` are the ones to watch - they could fail due to a real breakage, or if they were previously passing by luck due to conflicting line endings."},"comment":{"url":"https://api.github.com/repos/red-gate/ngit/issues/comments/164551729","html_url":"https://github.com/red-gate/ngit/pull/7#issuecomment-164551729","issue_url":"https://api.github.com/repos/red-gate/ngit/issues/7","id":164551729,"user":{"login":"GrahamTheCoder","id":2490482,"avatar_url":"https://avatars.githubusercontent.com/u/2490482?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamTheCoder","html_url":"https://github.com/GrahamTheCoder","followers_url":"https://api.github.com/users/GrahamTheCoder/followers","following_url":"https://api.github.com/users/GrahamTheCoder/following{/other_user}","gists_url":"https://api.github.com/users/GrahamTheCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamTheCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamTheCoder/subscriptions","organizations_url":"https://api.github.com/users/GrahamTheCoder/orgs","repos_url":"https://api.github.com/users/GrahamTheCoder/repos","events_url":"https://api.github.com/users/GrahamTheCoder/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamTheCoder/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T20:36:34Z","updated_at":"2015-12-14T20:36:34Z","body":"I've bumped the API version to 2.0.0 for the change so it's ready to merge after review"}}