{"thread":{"id":"21697","subject":"Per file configurable eol-style transformations with Git?","startedAt":"2009-11-21T20:21:40Z","lastAt":"2009-11-22T01:24:38Z","messageCount":4,"participants":["Alexander Veit","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"128070","messageId":"9ED0EB52C33C41209726C6F4DB7FC194@helium","threadId":"21697","inReplyTo":null,"subject":"Per file configurable eol-style transformations with Git?","fromName":"Alexander Veit","fromEmail":"alexander.veit@gmx.net","sentAt":"2009-11-21T20:21:40Z","receivedAt":"2009-11-21T20:21:40Z","isPatch":false,"sender":{"key":"alexander.veit@gmx.net","avatar":"https://gravatar.com/avatar/6c8f105bf5e4c0df37bc436c17b060f60d2a6bc34945eca584b77b73b5e05eb8?d=mp&s=160"},"body":"Hi,\n\nwe have projects that contain text files that need to\nhave different end-of-line sequences, depending on the\ntype of file, and depending on the operating system where\nthey are checked out.\n\nThere are files that have\n\n - LF line breaks on each platform,\n - CR LF line breaks on each platform, or\n - either LF or CR LF line breaks, depending on the\n   platform's native end-of-line style.\n\nWith Subversion, the correct behaviour in checkouts, commits,\ndiffs, or merges can easily be achieved by setting the appropriate\nsvn:eol-style [*].\n\nAs I understand the Git documentation there's no such concept as a\nrepository end-of-line style, or as an end-of-line transformation\nbetween repository and working copy.\n\nSo I wonder if it is possible to mimic Subversion's end-of-line handling\nwith Git, especially for the svn:eol-style=native.\n\n-- \nRegards,\nAlex\n\n\n[*]\nhttp://svnbook.red-bean.com/nightly/de/svn-book.html#svn.advanced.props.special.eol-style\n"},{"id":"128083","messageId":"m3tywnbmpj.fsf@localhost.localdomain","threadId":"21697","inReplyTo":"9ED0EB52C33C41209726C6F4DB7FC194@helium","subject":"Re: Per file configurable eol-style transformations with Git?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-21T21:18:16Z","receivedAt":"2009-11-21T21:18:16Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Alexander Veit\" <alexander.veit@gmx.net> writes:\n\n> we have projects that contain text files that need to\n> have different end-of-line sequences, depending on the\n> type of file, and depending on the operating system where\n> they are checked out.\n> \n> There are files that have\n> \n>  - LF line breaks on each platform,\n>  - CR LF line breaks on each platform, or\n>  - either LF or CR LF line breaks, depending on the\n>    platform's native end-of-line style.\n> \n> With Subversion, the correct behaviour in checkouts, commits,\n> diffs, or merges can easily be achieved by setting the appropriate\n> svn:eol-style [*].\n> \n> As I understand the Git documentation there's no such concept as a\n> repository end-of-line style, or as an end-of-line transformation\n> between repository and working copy.\n> \n> So I wonder if it is possible to mimic Subversion's end-of-line handling\n> with Git, especially for the svn:eol-style=native.\n\nSee `crlf` attribute, which can be set, unset, unspecified, set to\n\"input\", and used together with core.autocrlf (\"true\", \"false\", \"input\")\nand core.safecrlf.  Attributes can be set per path (using globbing\npatterns) in .gitattributes file in tree, or in .git/info/attributes\n(per repository).\n\nHTH\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"128086","messageId":"1050CAACABF64864A0CF79C957BF773B@helium","threadId":"21697","inReplyTo":"m3tywnbmpj.fsf@localhost.localdomain","subject":"Re: Per file configurable eol-style transformations with Git?","fromName":"Alexander Veit","fromEmail":"alexander.veit@gmx.net","sentAt":"2009-11-21T23:49:57Z","receivedAt":"2009-11-21T23:49:57Z","isPatch":false,"sender":{"key":"alexander.veit@gmx.net","avatar":"https://gravatar.com/avatar/6c8f105bf5e4c0df37bc436c17b060f60d2a6bc34945eca584b77b73b5e05eb8?d=mp&s=160"},"body":"Jakub Narebski wrote:\n\n> See `crlf` attribute, which can be set, unset, unspecified, set\n> to \"input\", and used together with core.autocrlf (\"true\", \"false\",\n> \"input\") and core.safecrlf.  Attributes can be set per path (using\n> globbing patterns) in .gitattributes file in tree, or in\n> .git/info/attributes (per repository).\n\nI've already tried \n\n[core]\n  autoCRLF = true\n\nin the global gitconfig under Windows. After git clone an immediate\ngit diff shows every line changed in certain files:\n\ndiff --git a/c_crlf_text.txt b/c_crlf_text.txt\nindex 3b0a76f..3473745 100644\n--- a/c_crlf_text.txt\n+++ b/c_crlf_text.txt\n@@ -1,5 +1,5 @@\n-z1\n-z2\n-z3\n-z4\n-\n+z1\n+z2\n+z3\n+z4\n+\n\nfile * on Windows:\nc___lf_text.txt;  ASCII text, with CRLF line terminators\nc_crlf_text.txt;  ASCII text, with CRLF line terminators\n\n\nfile * on Linux\nc_crlf_text.txt:  ASCII text, with CRLF line terminators\nc___lf_text.txt:  ASCII text\n\nI don't know if this behaviour is supposed to be correct,\nbut to me it seems to be wrong.\n\ngit version 1.6.5.1.1367.gcd48\n\n-- \nCheers,\nAlex\n"},{"id":"128088","messageId":"7v6393nyg9.fsf@alter.siamese.dyndns.org","threadId":"21697","inReplyTo":"1050CAACABF64864A0CF79C957BF773B@helium","subject":"Re: Per file configurable eol-style transformations with Git?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-22T01:24:38Z","receivedAt":"2009-11-22T01:24:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alexander Veit\" <alexander.veit@gmx.net> writes:\n\n> Jakub Narebski wrote:\n>\n>> See `crlf` attribute, which can be set, unset, unspecified, set\n>> to \"input\", and used together with core.autocrlf (\"true\", \"false\",\n>> \"input\") and core.safecrlf.  Attributes can be set per path (using\n>> globbing patterns) in .gitattributes file in tree, or in\n>> .git/info/attributes (per repository).\n>\n> I've already tried \n>\n> [core]\n>   autoCRLF = true\n>\n> in the global gitconfig under Windows.\n\nThat would not be per-file anyway.\n\nWhat Jakub suggested makes sense.  You want to read up on\ngitattributes(5).\n"}]}