I’ve seen a use "\n" for line endings instead of "\r\n" error here.
I wonder if it’s a good idea to have a .gitconfig file in the repo that makes sure that EOLs are already \n and not \r\n? I think a .gitconfig in a repo can override global git config automatically so people don’t have to use this explicitly.
What would be the best way to implement this, and do other collections do this? Do you see any drawbacks to this approach?
I’d rather use linter on pre-receive or something similar, but if you’d like to go client-side than maybe use .gitattributes instead. You can commit it in repository and it will be respected.
So something like below should do:
* text eol=lf
This way anyone staging with CRFL will get a warning that files will be converted and then conversion will take place on commit.
If you like to read more about this have a look here or here.
The trouble I have with solution using .gitconfig (and most client side solutions) is that anyone who clone the repo need to include it manually. And we all know how easy is to forget to do even the basic things So the best action to take is require no action from others