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

4

24

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+LF). I've tried adding the lines to the subversion config file to force it to use LF, and yes, I did set the enable-auto-props = yes. This doesn't work, and even if it did, it's not exactly what I want, because I'd rather have TSVN simply not touch the files. Just copy them as is.

Azole answered 20/7, 2012 at 22:36 Comment(0)
A
26

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.)

Aviator answered 22/7, 2012 at 14:19 Comment(2)
To clarify the statement about setting svn:eol-style: as A.H. points out in their answer, for existing files, this must be done for each file. That is, there is no "global" setting that will automatically change this for all EXISTING repository files. Instead, each file must have that property applied, then do a commit of all those files. See bahrep's answer for links.Enlighten
As %appdata% already denotes the Roaming folder, that level of the path should be left out.Inanimate
T
3

The auto-props configuration setting only works for new files, not for existing files. For those you have to set the svn:eol-style property for each file.

Typescript answered 22/7, 2012 at 11:3 Comment(0)
G
1

As of Tortoise SVN version 1.12.0, Build 28568, 2019/04/16, you can assign AS-IS EOL properties to an entire folder.

Select Workspace : Right-click : TortoiseSVN -> : Properties

Select New : EOL

Choose As is (no specific EOL)

Gurrola answered 2/7, 2019 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.