Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: "Inconsistent line ending style" - Checking in a file with ^M intentionally

Tags:

bash

svn

Using svn version 1.3.1 (unable to upgrade due to a configuration controlled CM server) on CentOS 4.2.

My code (a bash script) specifically has a ^M in it for an important reason. Unfortunately, subversion will not let me check this file in. It complains that:

svn: Commit failed (details follow):
svn: Inconsistent line ending style
svn: Your commit message was left in a temporary file:

I have proven that removing the single ^M from my code allows it to be checked in. How do I tell subversion that the ^M is intentional and that it should allow the file to be checked in?

like image 876
Chuck Wolber Avatar asked Oct 06 '09 21:10

Chuck Wolber


2 Answers

You need to remove the svn:eol-style property from your file. Subversion didn't care about line endings in your file until this property was added. To quote the subversion book:

This means that by default, Subversion doesn't pay any attention to the type of end-of-line (EOL) markers used in your files.

The book then goes on describing how you can make subversion care about the line endings by setting the svn:eol-style, which is exactly what you don't want.

like image 134
Wim Coenen Avatar answered Sep 22 '22 17:09

Wim Coenen


Another approach would be to get rid of the control character in the program in the first place; this might have other compatibility benefits, and might avoid problems with editing in the future.

You can generate a \r in bash easily with

`printf '%b' '\015'`

So, for example:

$ echo abc`printf %b '\015'`def
def
$ 

Or:

$ c=`printf %b '\015'`
$ set | grep ^c=
c=$'\r'
$ 

(Note: I know there are easier ways than by calling printf. Unfortunately, those easier ways are different in bash and posix shells. A bash-only solution is quite nice: $'\r'. Ash-only even nicer: c='\r. I'm not sure if ash does this because it's ash or because it's posix.)

like image 21
DigitalRoss Avatar answered Sep 23 '22 17:09

DigitalRoss