Search code examples
xmlsvnnormalizationeol

How can I normalize line endings of XML documents and XSLT templates using SVN?


I need to make sure XML and XSLT files are checked in with consistent line endings regardless of the IDE or operating system used for development. How do I configure SVN to do this, and get the rest of my team to do the same?


Solution

  • Open the config file for your svn client:

    vi ~/.subversion/config
    

    Add or uncomment the following settings:

    [miscellany]
    enable-auto-props = yes
    
    [auto-props]
    *.xml = svn:eol-style=native
    *.xsd = svn:eol-style=native
    *.xsl = svn:eol-style=native
    

    Document this on the team wiki.

    Create an alias to convert existing files, and share it with the team:

    alias svn_clean='svn propset svn:eol-style "native" *; svn commit'
    

    References