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?
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.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With