{"thread":{"id":"42139","subject":"How to have EOL=LF and keep binary files auto-detection?","startedAt":"2016-04-25T14:11:51Z","lastAt":"2016-04-26T15:31:16Z","messageCount":3,"participants":["Kirill Likhodedov","Torsten Bögershausen","Nikolay Chashnikov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"284403","messageId":"3670335C-4938-4DCD-9B1D-6B4737CBE6C2@jetbrains.com","threadId":"42139","inReplyTo":null,"subject":"How to have EOL=LF and keep binary files auto-detection?","fromName":"Kirill Likhodedov","fromEmail":"kirill.likhodedov@jetbrains.com","sentAt":"2016-04-25T14:11:51Z","receivedAt":"2016-04-25T14:11:51Z","isPatch":false,"sender":{"key":"kirill.likhodedov@jetbrains.com","avatar":"https://gravatar.com/avatar/9fd55d2a110e8e96deb3ed7b503d7f3b9b5b1ed5ca9ef6683c15525b11b94e63?d=mp&s=160"},"body":"Hi, \n\nI wonder if it is possible both to have LFs in all and only text files in working trees, and keep Git’s binary files auto-detection?\n\nTo be more precise:\n* we want all text files to be checked out in LF; \n* we don’t want force people to set “core.autocrlf” to false, preferring to keep this configuration in .gitattributes; \n* we obviously don’t want binary files to be touched by eol-normalization; \n* we also don’t want to declare all possible patterns of binary files - Git is good enough in detecting them automatically.\n\nHowever, I’ve found no way to do so.\n\nIf I declare `* eol=lf` in .gitattributes, it makes Git treat all files as text and thus convert CRLF to LF even in binary files. It is consistent with man, but a bit surprising to have e.g. a zip or png file modified in this way.\n\nOne could expect `* text=auto eol=lf` to work the way we want, but unfortunately it doesn’t work either: “eol=lf” forces “text” on all files.\n\nThanks a lot for your help!\n-- Kirill.\n"},{"id":"284434","messageId":"4501b117-09e9-d24c-e209-bda28059765a@web.de","threadId":"42139","inReplyTo":"3670335C-4938-4DCD-9B1D-6B4737CBE6C2@jetbrains.com","subject":"Re: How to have EOL=LF and keep binary files auto-detection?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-04-25T16:46:02Z","receivedAt":"2016-04-25T16:46:02Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 25.04.16 16:11, Kirill Likhodedov wrote:\n> Hi, \n> \n> I wonder if it is possible both to have LFs in all and only text files in working trees, and keep Git’s binary files auto-detection?\n> \n> To be more precise:\n> * we want all text files to be checked out in LF; \n> * we don’t want force people to set “core.autocrlf” to false, preferring to keep this configuration in .gitattributes; \n> * we obviously don’t want binary files to be touched by eol-normalization; \n> * we also don’t want to declare all possible patterns of binary files - Git is good enough in detecting them automatically.\n> \n> However, I’ve found no way to do so.\n> \n> If I declare `* eol=lf` in .gitattributes, it makes Git treat all files as text and thus convert CRLF to LF even in binary files. It is consistent with man, but a bit surprising to have e.g. a zip or png file modified in this way.\n> \n> One could expect `* text=auto eol=lf` to work the way we want, but unfortunately it doesn’t work either: “eol=lf” forces “text” on all files.\n> \n> Thanks a lot for your help!\n> -- Kirill.\n\nThe short answer: Git doesn't currently do that.\nThe closest you can get, is to use\necho \"* text=auto\" >.gitattributes\nand\ngit config core.eol lf\ngit config core.autocrlf false.\n\nThe longer answer is, that I am working on a patch to allow just\nthe combination of \"* text=auto eol=lf\" to work as you want it.\n\nWhich platform do you use ?\nAnd (out of curiosity, why do you want text files with LF ?)\n\nIf you are willing to compile and install Git yourself,\nyou can use the branch here:\nhttps://github.com/tboegi/git/commits/160421_0706_reliable_t0027_allow_TC_combined_ident_CRLF_v7\n\nFeedback is welcome, if it works as expected.\n"},{"id":"284525","messageId":"CALnWy=-3ncjHZOHuE6aEp-GGhErkccQLed+oGBMYOFu7YcEHqA@mail.gmail.com","threadId":"42139","inReplyTo":"4501b117-09e9-d24c-e209-bda28059765a@web.de","subject":"Re: How to have EOL=LF and keep binary files auto-detection?","fromName":"Nikolay Chashnikov","fromEmail":"nikolay.chashnikov@jetbrains.com","sentAt":"2016-04-26T15:31:16Z","receivedAt":"2016-04-26T15:31:16Z","isPatch":false,"sender":{"key":"nikolay.chashnikov@jetbrains.com","avatar":null},"body":"Thank you for the information.\n\nWe create products (IDEs for different programming languages) for the\nthree major platforms (Window/Linux/Mac OSX). Our products are written\nin Java and we want to minimize differences between distributions for\ndifferent platforms, so we use LF separators for all resource files.\n\nOn Mon, Apr 25, 2016 at 7:46 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 25.04.16 16:11, Kirill Likhodedov wrote:\n>> Hi,\n>>\n>> I wonder if it is possible both to have LFs in all and only text files in working trees, and keep Git’s binary files auto-detection?\n>>\n>> To be more precise:\n>> * we want all text files to be checked out in LF;\n>> * we don’t want force people to set “core.autocrlf” to false, preferring to keep this configuration in .gitattributes;\n>> * we obviously don’t want binary files to be touched by eol-normalization;\n>> * we also don’t want to declare all possible patterns of binary files - Git is good enough in detecting them automatically.\n>>\n>> However, I’ve found no way to do so.\n>>\n>> If I declare `* eol=lf` in .gitattributes, it makes Git treat all files as text and thus convert CRLF to LF even in binary files. It is consistent with man, but a bit surprising to have e.g. a zip or png file modified in this way.\n>>\n>> One could expect `* text=auto eol=lf` to work the way we want, but unfortunately it doesn’t work either: “eol=lf” forces “text” on all files.\n>>\n>> Thanks a lot for your help!\n>> -- Kirill.\n>\n> The short answer: Git doesn't currently do that.\n> The closest you can get, is to use\n> echo \"* text=auto\" >.gitattributes\n> and\n> git config core.eol lf\n> git config core.autocrlf false.\n>\n> The longer answer is, that I am working on a patch to allow just\n> the combination of \"* text=auto eol=lf\" to work as you want it.\n>\n> Which platform do you use ?\n> And (out of curiosity, why do you want text files with LF ?)\n>\n> If you are willing to compile and install Git yourself,\n> you can use the branch here:\n> https://github.com/tboegi/git/commits/160421_0706_reliable_t0027_allow_TC_combined_ident_CRLF_v7\n>\n> Feedback is welcome, if it works as expected.\n>\n>\n>\n>\n\n\n\n-- \nNikolay Chashnikov\nJetBrains\nhttp://www.jetbrains.com\nThe Drive to Develop\n"}]}