EOL handling
[mono.git] / .gitattributes
1 *.c     crlf
2 *.h     crlf
3 *.cs    crlf
4 *.sh    crlf
5
6 ChangeLog       crlf
7 *akefile*       crlf
8 *.sources       crlf
9
10 # don't do anything to line-endings.  Let CRLFs go into the repo
11 *.bat           -crlf
12 *.sln           -crlf
13 *.*proj*        -crlf
14
15 # CRLF Handling
16 # -------------
17 #
18 # The ideal situation would be to do no EOL normalization.  Each file
19 # would have a default EOL, and tools on Windows and Linux would handle
20 # both EOL formats.
21 #
22 # We're not in the ideal world.  A popular editor on Windows (possibly
23 # Visual Studio) silently introduces EOL corruption -- it displays an
24 # LF-file normally, but any newly added lines have CRLF.  On Linux,
25 # Emacs and versions of VI handle LF-files and CRLF-files properly.
26 # However, emacs doesn't like files with both LF and CRLF EOLs.  Editing
27 # the file without additional action will increase the EOL corruption
28 # in the file.
29 #
30 # Another vector for mixed EOLs is scripts.  We mostly don't have scripts
31 # that add new lines -- so we rarely see this.  However, one major event
32 # in the tree was the addition of copyright headers using a script.  That
33 # script introduced EOL corruption.
34 #
35 # Any automated EOL normalization of files already in the repository will
36 # cause difficulties in traversing histories, assigning blame, etc.  So, we
37 # don't want to change what's in the repository significantly, even if it
38 # causes trouble.
39 #
40 # What we do now:
41 #
42 # a) we ensure that there's no further corruption of LF-files.  So, we use
43 #    git's 'crlf' attribute on those files to ensure that things are fine
44 #    when we work on Windows.  We could use 'crlf=input', but it doesn't buy
45 #    us much -- we might as well be working with consistent EOLs for files in
46 #    working directories as well as in the repository
47 #
48 # b) if the file already of CRLFs, we don't do any normalization.  We use '-crlf'
49 #    so that git doesn't do any EOL-conversion of the file.  As I said, this
50 #    is mostly harmless on Linux.  We can't mark these files as 'crlf' or use
51 #    the new (git 1.7.2) 'eol=crlf' attribute, since it changes the contents
52 #    _inside_ the repository [1], and hence makes history traversal annoying.
53 #    So, we live with occasional EOL corruption.
54 #
55 # c) We can handle mixed-EOL files on a case-by-case basis, converting them to
56 #    LF- or CRLF-files based on which causes fewer lines to change
57 #
58 # d) We try to ensure no further headaches, by declaring EOL normalization on
59 #    code files, and Unix-flavoured files, like shell-scripts, makefiles, etc.
60 #
61 # [1] GIT use LFs as the normalized internal representation.