Is there anyway to get TortoiseSVN to leave EOL (line endings) as is?

后端 未结 4 735
感情败类
感情败类 2021-02-01 18:46

I\'m checking out files that have Linux style line endings (just LF char). When I check out a file with TortoiseSVN in Windows, it converts the line endings to Windows style (CR

4条回答
  •  醉梦人生
    2021-02-01 19:14

    As others have pointed out, you need to set the svn:eol-style property. This property can have three values:

    • LF: Set end-of-lines automatically to Unix line endings upon checkout and commit.
    • CRLF: Set end-of-lines automatically to Windows line endings upon checkout and commit.
    • native: This will store line endings upon commit to Unix line endings (LF), but will checkout the line endings with either LF or CRLF based upon the client.

    You can set the auto-props settings in your $HOME/.subversion/config file to automatically attach this property to all new files. However, this is something each user must set in their Subversion client. To enforce setting this property, you can use my pre-commit hook which will reject commits if the files you've specified don't have the properties you've specified set to their correct values.

    This is a crude bludgeon since it won't correct the problem, but after one or two failed commits, developers will quickly set their auto-props up to automatically add the needed properties.


    For TortoiseSVN on Windows, find the config file under your username/AppData (a hidden folder). E.g.

    %appdata%\roaming\subversion\config

    Add these lines (probably already there, but commented out), then logout/in:

    enable-auto-props = yes
    # Add these for each text file type that you use:
    *.txt = svn:eol-style=native
    *.cs = svn:eol-style=native
    *.xml = svn:eol-style=native
    

    (Example is for C# with XML; replace with whatever text files you use.)

提交回复
热议问题