Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 705
Brent212 Avatar asked Jul 20 '12 22:07

Brent212


People also ask

What does red exclamation mark mean in TortoiseSVN?

That means the Subversion status is normal. As soon as you start editing a file, the status changes to modified and the icon overlay then changes to a red exclamation mark. That way you can easily see which files were changed since you last updated your working copy and need to be committed.

Does TortoiseSVN include Subversion?

TortoiseSVN is a really easy to use Revision control / version control / source control software for Windows. It is based on Apache™ Subversion (SVN)®; TortoiseSVN provides a nice and easy user interface for Subversion.

What line endings does Windows use?

Back to line endings The reasons don't matter: Windows chose the CR/LF model, while Linux uses the \n model. So, when you create a file on one system and use it on the other, hilarity ensues.

What TortoiseSVN is used for?

TortoiseSVN is a Subversion client, implemented as a Microsoft Windows shell extension, that helps programmers manage different versions of the source code for their programs. It is free software released under the GNU General Public License.


2 Answers

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

like image 157
David W. Avatar answered Dec 09 '22 04:12

David W.


You should set svn:eol-style property.

http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-propertypage.html

http://svnbook.red-bean.com/en/1.7/svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style

like image 44
bahrep Avatar answered Dec 09 '22 04:12

bahrep