Kelvin
Kelvin

Reputation: 975

How should I Fix "svn: Inconsistent line ending style"?

When I run "svn propedit svn:ignore ." at the root of my svn repository, I get this error: svn: Inconsistent line ending style

I have tried to run this script: http://blog.eflow.org/archives/130 which runs dos2unix and sets the eol-style on all of the files, however this problem still persists. Any idea what could be wrong?

Upvotes: 41

Views: 87863

Answers (22)

robsosno
robsosno

Reputation: 328

I have yet another case. Text file was in Unicode. Example case: WebConversationStateTest.cs After converting Unicode (UTF-16) to UTF-8 everything was ok.

Upvotes: 0

Matthias Kuhn
Matthias Kuhn

Reputation: 170

For me the Problem was that the encoding was UTF-16 BE BOM. I had to convert it to UTF-8 BOM using Notepad++ (Encoding -> Convert To UTF-8 BOM).

Upvotes: 0

Ramakrishna Talla
Ramakrishna Talla

Reputation: 1079

As 'Marius Matioc' suggested in above, would be easy and quick fix 1.Open file in Notepad++ 2.Edit menu -> EOL Conversion -> Unix 3.Save 4.Edit menu -> EOL Conversion -> Windows 5.Save

Upvotes: 1

Jasper de Vries
Jasper de Vries

Reputation: 20188

In NetBeans you can use the "Show and change line endings" plugin.

After installing it and restarting NetBeans, the line ending style is shown at the right side of the status bar. You can click it and select the ending you want to convert the file to.

NetBeans Show and change line endings plugin

Upvotes: 1

Marius Matioc
Marius Matioc

Reputation: 557

In my case I was editing in Windows. To fix:

  1. Open file in Notepad++
  2. Convert line ending to Unix (Edit menu -> EOL Conversion -> Unix)
  3. Save
  4. Convert line endings to Windows (Edit menu -> EOL Conversion -> Windows)
  5. Save

This did it.

Upvotes: 33

David Gausmann
David Gausmann

Reputation: 1718

In my case the error occurred because the file had the encoding "UCS-2 LE BOM". The files with ANSI were ok. I checked the line endings, in all files they were correct. It seems that (at least in my SVN version) wide char files are sometimes not recognized properly.

The simplest solution is it to remove the "svn:eol-style" property.

Upvotes: 0

EoghanM
EoghanM

Reputation: 26934

I got the same error message when trying to svn propset eol-style:native a PHP file in emacs, so hopefully this will help someone out who reaches this question.

I had something like the following:

str_replace('</li>^M<br>', '</li>', $text);

Where ^M is a single character (caret escape for carriage return).

The fix was to change that line to the equivalent:

str_replace("</li>\r<br>", '</li>', $text);

Note the double quotes instead of single quotes!

Upvotes: 0

Douglas
Douglas

Reputation: 1

I had a same problem in a archive that was working well before. In notepad++, i've chosen convert format to UTF-8. This worked for me.

Upvotes: 0

Franck de Bruijn
Franck de Bruijn

Reputation: 311

I had the same problem when running javadoc via an ant task on a Windows machine.

I fixed it by adding <fixcrlf srcdir="${dir.javadoc}" eol="dos"/> below the javadoc ant task.

Upvotes: 0

Sean
Sean

Reputation: 10206

To consistently convert Windows to UNIX line endings using perl(1):

perl -p -i.bak -e 's#\r\n#\n#go' my-file.txt

To convert from UNIX back to Windows:

perl -p -i.bak -e 's#\n#\r\n#go' my-file.txt

Upvotes: 0

Bizmarck
Bizmarck

Reputation: 2688

The problem occurred for me after some modifications in several text files was made such that only \n were added to seperate certain lines, whereas normally \r\n terminate every line. So, the fix was to use Notepad++ to find ([^\r])\n and replace with $1\r\n. This way the end of line characters were consistent everywhere.

Upvotes: 0

Ray Hunter
Ray Hunter

Reputation: 15557

For mac osx, I got this error for a file and had to convert it using dos2mac and then mac2unix. Once I did that it fixed the issue for the line endings complaining.

Upvotes: 0

FilippoG
FilippoG

Reputation: 586

This bothered me for so long, working an a multi-system team with SVN. I made this useful app, that navigates a folder with sub-folders looking for text files and converts all UNIX EOL to DOS EOL. It is an AIR app, works on both Windows and Mac. hope it helps

http://www.pippoflash.com/index.php/2012/06/11/svn-error-inconsistent-line-ending-style-nightmare-solved-download-app/

Filippo

Upvotes: 0

If it only happens with one or two files, you can also open the file, copy and paste the content to a new file (with a normal text editor), and save it. This file can then be added (rename or move to make it the correct name).

Upvotes: 3

evgeny9
evgeny9

Reputation: 1441

In my case, svn:eol-style property was set on a file. And "some lines of the file were separated by UNIX line endings (LF character), while others were separated by DOS-style line endings (CR+LF characters)". Here is another detailed discussion of this problem.
"Edit"->"EOL Conversion"->"Windows format" in Notepad++ solved the issue for me.

Upvotes: 43

gollumullog
gollumullog

Reputation: 1249

Running

unix2dos [file]

via cygwin fixed this for me.

Upvotes: 8

Isaac
Isaac

Reputation: 11

vi didn't show me the bad line so i removed the end of lines from the comment section, readded them (up to END) and saved the file. it worked after that.

NOTE: backup you revprop file before tweaking it. if you turf it, no going back

Upvotes: 1

Amos Van Horn
Amos Van Horn

Reputation: 41

My problem was that I was getting this in Visual Studio.NET. To fix it, I copied all the text of the file into notepad and saved it from Notepad to "xxx.aspx" or whatever the proper file name is. Then in Visual Studio, I was prompted to reload a changed file, and voila - a dialog box asking me if I would like to normalize my line endings. Problem solved.

Upvotes: 4

Geir Engebakekn
Geir Engebakekn

Reputation: 11

I got this error, but it ended up being a file missing the last End-of-lie( incomplete last line).

Correcting this by opening the file in VI and saving it solved it.

Upvotes: 1

Wim Coenen
Wim Coenen

Reputation: 66733

Subversion is not complaining about the content of any file, but about the content of the svn:ignore property. One way to fix this is to simply delete the svn:ignore property with svn propdel and then recreate it.

Another way which may be easier if you have a lot of lines in your svn:ignore:

  1. fetch the value of svn:ignore in a temporary file like this:

    svn propget svn:ignore . > temp

  2. fix the line endings in the temp file
  3. set the value of svn:ignore from the fixed file like this:

    svn propset svn:ignore -F temp .

Upvotes: 19

Volker Stolz
Volker Stolz

Reputation: 7402

If you get it while doing the propedit, then it seems to me more that SVN is complaining about the format of the text file you're using for the properties!

Which OS are you on? Which editor are you using to propedit? If the propedit command still fires up an editor, I would use this editor to check which line endings are in there (vi does this IIRC).

Upvotes: 0

Timo Geusch
Timo Geusch

Reputation: 24351

Did the script definitely touch each and every text file (assuming you do have dos2unix installed, otherwise that'd be why...)?

The other things I can think of is to check that all files have their mime-type set correctly (you don't have a binary file that's somehow marked as a text file checked in, perchance?).

That said, if you are in a multi-OS environment I consider it not a good idea to set svn:eol-style to CRLF as described in the blog post above if you are sharing and editing text files between OSs. Because if you do it that way, the files that look OK in Windows are littered with control characters in Unix. Better to use 'native' as the EOL style.

Upvotes: 1

Related Questions