.gitattributes 2.8 KB

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