Epoc
Epoc

Reputation: 7486

"Inconsistent line ending style" nightmare

I'm completely stuck with an SVN error when committing 2447 files at once. I'm using TortoiseSVN (latest version) on Windows 7 64 bits.

The fact is that some files were created on Mac, and others on PC, so TortoiseSVN stopped the commit with an annoying Inconsistent line ending style error.

In the beginning, to solve this problem, I manually opened the incriminated file in NetBeans, added one blank space, removed it and saved the file so NetBeans converted properly all line ending characters, but it seems there are more than "some files" incriminated.

Upvotes: 18

Views: 26220

Answers (8)

Epoc
Epoc

Reputation: 7486

You can capture the w, (\w)\n$, and replace it with $1\r\n where $1 is the character.

Searching and replacing with NetBeans with this regex does the job.

My problem was that a custom script inserted wrong EOL characters (\n instead of \r\n) in these files).

(I answered my own question with @assylias's comment.)

Upvotes: 3

iggy12345
iggy12345

Reputation: 1383

I opened the project properties window by right-clicking the file explorer while browsing the repository I wanted to edit, and then selected:

TortoiseSVNPropertiesNew...EOLAs is (no specific EOL)OK.

Upvotes: 1

user2827968
user2827968

Reputation:

To solve the problem with different line endings, you can set the Subversion (SVN) property as follows:

svn propset svn:eol-style native my_file

Although this will solve the line endings problems and make merging easier, it will mean that blame will show the person adding the EOL-style as the changer of all lines, and it also means that your working files will end up getting copied into a temporary folder when doing a diff.

The blame issue can be solved afterwards by doing this:

svn blame my_file -x "--ignore-space-change --ignore-eol-style"

Upvotes: 0

jla
jla

Reputation: 7414

If your line endings are all in order, it could be that your text file has a UTF-16 byte order mark (BOM).

You can fix that using Notepad++. Menu EncodingConvert to UTF-8.

Upvotes: 2

Tuna
Tuna

Reputation: 2995

Under Windows 7, you can use Notepad++ v5.6.8 to convert EOL characters:

Menu EditEOL ConversionWindows / Unix / Mac

Upvotes: 26

Rolland Dudemaine
Rolland Dudemaine

Reputation: 71

In relation to the post from Fabian Streitel, actually the Vim regular expression should be :1,$s/\r//g to cover the entire file.

Another way on Unix-like systems is using sed:

sed -i '-es/\r//g' <your_file>

Upvotes: 0

Fabian Streitel
Fabian Streitel

Reputation: 2800

In Vim or gVim under Windows, the broken files all showed ^M at the end of each line.

To fix it: :s/\r//g to remove the broken extra line endings.

Upvotes: 0

Dror Harari
Dror Harari

Reputation: 3287

In Notepad++, select menu ViewShow SymbolShow End of Line.

In the search box (Ctrl + F), select the Regular Expression search mode and search for the string:

[^\r]\n$

(translation: \n without a \r before it).

This will bring you directly the problem line(s) where you'll see the line ending with LF rather than with the pair CR-LF.

Upvotes: 3

Related Questions