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

Using svn version 1.3.1 (cannot be updated due to configuration managed CM server) on CentOS 4.2.

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

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

I proved that removing the only ^ M from my code allows me to verify it. How to tell subversion that ^ M is intentional and that it should allow file verification?

+6
bash svn
source share
5 answers

You need to remove the svn: eol style property from your file. Subversion was not interested in line endings in your file until this property was added. To quote a subversion book :

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

The svn:eol-style book describes how you can make subversive custody of line endings by setting svn:eol-style , which is exactly what you don't want.

+10
source share

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

You can easily generate \r in bash 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 that there are simpler methods than calling printf. Unfortunately, these simple methods differ in bash and posix shells. The bash solution is pretty simple: $'\r' . Even nicer: c='\r . I'm not sure ash does this because he is angry or because he is posix.)

+1
source share

I assume it is used as a string or something like that. Is there a way for bash to encode characters?

0
source share

I think you need to use the svn:eol-style property:

 svn propset svn:eol-style LF myscript.sh 

will cause Subversion to always treat the file as LF-style.

0
source share

I think you can set the svn: mime-type property to something non-textual (e.g. application / octet-stream?). This can cause subversion to ignore line endings.

See section Type of file content in svnbook.

0
source share

All Articles