-
Notifications
You must be signed in to change notification settings - Fork 28
/
.gitattributes
85 lines (81 loc) · 3.96 KB
/
.gitattributes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Line endings with Git is a complicated topic. The usual recommended setting on the internet is to set core.autocrlf to true
# on Windows and leave it false otherwise. In theory this should work, but Git doesn't correctly determine which files are binary
# and which files are text (maybe due to the UTF-8 byte order mark?), which resulted in a mess in the repository. Maybe our original
# TFS import also contributed to this issue. The solution for this is to manually normalize the repository and explicitly specify
# which files are text and which are binary from then on. See the bottom of this files for details on how to update this file.
#
# References:
# - https://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/
# - https://help.github.com/articles/dealing-with-line-endings#platform-all
# - gitattributes(5) manpage
#
# This requires git 1.7.2+ (released about two years ago), which hopefully should be standard by now. Contributions to existing files
# should work fine with an earlier git, but new files which aren't detected properly might cause problems.
# Try to do the sensible thing by default for new file types. This is effectively the same as setting core.autocrlf to true by default,
# which has the nice side-effect that all our configuration is contained in the repository.
* text=auto
# these are all text files and should be treated as such
*.asax text
*.bat text
*.c text diff=cpp
*.config text
*.cpp text diff=cpp
*.cs text diff=csharp
*.cshtml text diff=html
*.csproj text
*.css text
*.filters text
*.h text diff=cpp
*.js text
*.manifest text
*.resx text
*.settings text
*.sln text
*.txt text
*.TXT text
*.vcxproj text
*.wixproj text
*.wxl text
*.wxs text
*.xaml text
*.xml text
.gitattributes text
.gitignore text
README.md text
# These files are binary and shouldn't be touched by Git. Nice side-effect of the binary macro is that it suppresses diff output.
*.bmp binary
*.dll binary
*.exe binary
*.gif binary
*.ico binary
*.mpe1 binary
*.msm binary
*.pdb binary
*.png binary
*.psd binary
*.snk binary
*.swf binary
*.zip binary
# I generated the list of extensions by searching for all files in my current working directory and typing it over manually:
# $ find . -type f | grep -vE '^./.git/' | sed 's#^.*\.\([a-zA-Z0-9]*\)$#\1#' | sort -u
#
# Getting a list of the current line endings of text files can be done with the following commands (preferably on Linux, where
# Git doesn't change anything on checkout):
# $ find . -type f | grep -v '^./.git' | while read line; do file $line; done > /tmp/line-endings
# $ cat /tmp/line-endings | grep -vE '^./Libraries/((Artwork|Database|Installer|LICENSE.txt|Misc|MVC|Tools|TVEngine3|UI)/|Streaming/(ffmpeg|MediaInfo|segmenter|vlc-1.1.11))' > /tmp/text-line-ending
#
# You can get a list of files with wrong line-endings by grepping for CRLF in that file.
#
# You can also get a list of text file extensions from that list, but it's contents should be contained in the output of all
# extensions above:
# $ cat /tmp/text-line-endings | sed 's#^./.*\.\([a-zA-Z]*\):.*#\1#' | sort -u
#
# After editting this .gitattributes file, you need to re-normalize all files that have the wrong line-endings:
# $ rm .git/index
# $ git reset
# $ git status # This lists all files that will be normalized
# $ git add -u
# $ git add .gitattributes
# $ git commit
# $ rm -rf * # Force Git to rewrite the working directory with correct line endings
# $ git reset --hard