.gitattributes 2.6 KB

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