[windows] .gitattributes for proper line endings settings (#667)

Context: https://help.github.com/articles/dealing-with-line-endings/

If you work on this repo on Windows, you quickly see the `.gitattributes` are not setup right for development on Windows.

1. Certain files had mixed line endings, which causes Visual Studio to prompt to adjust.

2. Running `premake` yields Windows line endings on Windows, and so every `*.csproj` file appears to have changes.

`xamarin-android` has a well-used `.gitattributes` file, so I used it as a starting point and added an entry for `*.cake` files.

The way it works (as I understand it):
- `git` stores everything with unix line endings
- on checkout, clients convert the line endings according to settings in the `.gitattributes` file

So, for example:
- All `*.csproj` files will have Windows line endings, as Visual Studio expects (both Mac and Windows)
- `*.cs` files will have Windows line endings on Windows, and unix line endings on Mac
This commit is contained in:
Jonathan Peppers 2018-05-04 17:06:07 -05:00 коммит произвёл GitHub
Родитель 53783834f2
Коммит d697cdfca5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
28 изменённых файлов: 2812 добавлений и 2779 удалений

33
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,33 @@
# This file mainly controls line ending conversion behaviour, if
# the user has the setting core.autocrlf true.
# The meaning of the attributes is a little odd
# -crlf means DO NOT convert line endings
# crlf means CONVERT to lf in the repo, but always checkout using crlf
# on all platforms
# sln is always CRLF, even on linux, so don't convert
*.sln eol=crlf
*.bat eol=crlf
*.cmd eol=crlf
*.rtf eol=crlf
# Mostly generated by VS, so avoid extra noise
*.Designer.cs eol=crlf
*.cs text
*.cake text
*.xml text
*.md text
Makefile eol=lf
*.targets eol=crlf
*.proj eol=crlf
*.vcproj eol=crlf
*.vcxproj eol=crlf
*.csproj eol=crlf
*.shproj eol=crlf
*.projitems eol=crlf
*.tpnitems eol=crlf
*.wixproj eol=crlf
*.wxs eol=crlf
*.rtf eol=crlf