How to avoid mixed eol-styles in a svn repository

天大地大妈咪最大 提交于 2019-12-04 09:32:42

问题


Is there a best practice for preventing mixed eol-styles in a subversion repository.

I know that svn:eol-style=native can be set as an auto-prop, but I would have to ensure that it was set for all committers. I'm also reluctant to do a retrospective, repository-wide change of svn:eol-style if there is a less invasive solution.


回答1:


You should use pre-commit hooks on server-side.

Here is a hook you need: http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/check-mime-type.pl

This hook will enforce users to set correct eol-style.

See svn documentation on how to use them.

Also, you can implement your own hook which will set eol-style automatically.




回答2:


Note that as of SVN 1.8 you can set up auto-props for entire trees within your repository (including at the top level), which finally fixes this issue independent of client-side config.

See the following for more details:

  • The relevant part of the SVN 1.8 release notes
  • The entry on auto properties in svnbook (I'd advise you read about inheritable properties too, which is in the section immediately above)
  • A useful article on Apache's wiki about the subject, complete with examples for eol-style


来源:https://stackoverflow.com/questions/2509803/how-to-avoid-mixed-eol-styles-in-a-svn-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!