40

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?

Kelvin
  • 965
  • 2
  • 10
  • 13

22 Answers22

42

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.

evgeny9
  • 1,381
  • 3
  • 17
  • 31
  • 2
    Using TortoiseSVN on windows with context-menus in explorer enabled, you can right-click the file, then navigate to "TortoiseSVN" --> "Properties". A dialogue will popup. Look for a "EOL" property and edit it in the appropriate way or simply remove it, if you're sure that EOL does'nt matter in your context. – Gernot Oct 04 '16 at 14:52
  • 2
    For me "Windows format" was disabled". Then I have converted to unix and then converted to windows back. It worked for me. @marius solution. – Digital_Reality Dec 21 '17 at 05:31
  • 1
    In my case, the `svn:eol-style` property was set. However, (somehow) its value had become `nativenative` (instead of just `native`). Perhaps this can occur when applying an `svn diff` generated patch twice (with `svn patch`). The exact error was `svn: E135001: Unrecognized line ending style`. Changing the property value back to `native` fixed the problem. (Adding this comment here, since this is the top Google-search hit for the error above.) – Atafar Mar 06 '18 at 16:21
31

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.

andycraig
  • 710
  • 5
  • 18
Marius Matioc
  • 537
  • 6
  • 7
18

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 .

Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
  • 1
    I ended up having to use svn propdel and just recreate the property. When I tried your 2nd suggestion (propget > temp), I got the same message as I was getting with propedit. Thanks! – Kelvin Jun 26 '09 at 23:23
  • 3
    I found a 'svn:eol' property on a particular file, with the value 'native'. Deleting this property fixed the error for me. – Stewart Nov 24 '12 at 15:37
8

Running

unix2dos [file]

via cygwin fixed this for me.

gollumullog
  • 1,249
  • 2
  • 14
  • 22
  • First order approximation it is fine, but afaik unix2dos doesn't fix single CRs that can also cause this. (but are rare). In that case you better filter out CRs with "tr" directly, before doing unix2dos – Marco van de Voort Nov 09 '11 at 08:37
4

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.

  • 1
    Love stupid simple solutions like this. Couldn't care less about why this happened, just wanted it to go away for a file. This worked for an Eclipse project on Windows. – Kevin Nov 13 '12 at 22:11
  • This worked perfectly for me and I didn't have to muck with svn:ignore. Hooray! – Simon Tower May 30 '13 at 22:11
3

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

  • 1
    [Sometimes you have to appreciate the simple solutions](http://www.imdb.com/title/tt0383574/quotes?qt=qt0397310) – gobernador Jun 06 '12 at 15:45
1

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.

1

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

Isaac
  • 11
  • 1
1

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

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • Visual Studio Community has a similar feature in the bottom right corner of the status bar. This answer made me check! – drescherjm Oct 14 '22 at 21:35
1

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.

Timo Geusch
  • 24,095
  • 5
  • 52
  • 70
  • Timo, I'm quite sure the script touched every text file and I actually did change the script to "native" before running it. Also, I don't have any problems while checking things in, only while running the propedit command. Does that say anything? – Kelvin May 27 '09 at 23:07
0

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

FilippoG
  • 546
  • 3
  • 16
0

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.

Ray Hunter
  • 15,137
  • 5
  • 53
  • 51
0

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.

Bizmarck
  • 2,663
  • 2
  • 33
  • 48
0

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
Sean
  • 9,888
  • 4
  • 40
  • 43
0

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.

Franck de Bruijn
  • 311
  • 1
  • 2
  • 11
0

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.

0

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!

EoghanM
  • 25,161
  • 23
  • 90
  • 123
0

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.

David Gausmann
  • 1,570
  • 16
  • 20
0

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

Ramakrishna Talla
  • 1,011
  • 12
  • 7
0

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

Matthias Kuhn
  • 170
  • 2
  • 5
0

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.

robsosno
  • 308
  • 1
  • 7
0

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

Volker Stolz
  • 7,274
  • 1
  • 32
  • 50