SVN: change defaults for line endings
Jaroslaw Staniek
js at iidea.pl
Wed May 4 14:49:13 BST 2005
SVN: change defaults for line endings: from native to LF
1. Some Background
SVN defines so called 'eol-style' property. This defaults to 'native' value.
'native', 'LF', 'CRLF' values are described here:
http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3
While hacking within kde on win32, I developed a 'de facto' rule of using LF
line endings instead of CRLF on win32. This avoided breaking build tools and
saved from mistakes many times, especially on kdelibs/win32.
It's also not too hard to imagine that, in many cases, a developer may want to
move source files between unix and win32 filesystems, without a need for
recoding line endings. So, summing up: I assumed that win32 devs are forced to
use LF line endings.
In it's current state, KDE SVN uses 'native' eol-style. On checking out, you
will get 'native' line endings on win32, ie. CRLF what is against 'LF" policy.
To fix this by hand, it's required to run for every source directory we have
checked out:
% svn propset -R svn:eol-style LF *
This has to be done once, but note that in case when, after initial checking,
somebody added a file to the repositiory, 'svn up' will download these new
files in CRLF (native) mode on win32.
BUT: Isn't there a global switch within svn client to override 'native'
setting? Yes in subversion/config we can enable these lines:
[miscellany]
enable-auto-props = yes
[auto-props]
* = svn:eol-style=LF
...but in the doc I've mentioned above, you can read that this woks only for
'svn import' and 'svn add'. Existing files checked out from KDE repository,
will have preserver 'native' setting.
2. Solution
I'd like to ask coolo to fix eol-style properies for every text file at the
server side, before all people started to use SVN.
For example, change 'native' word to LF in .svn/props/something.h.svn-work:
/===============
K 13
svn:eol-style
V 2
native <-----------------------------------
K 12
svn:keywords
V 23
Author Date Id Revision
K 13
svn:mime-type
V 11
text/x-chdr
END
===============/
3. Notes
- The won't change behaviour on UNIX systems, since 'native' == 'LF' here.
Even MacOSX is not affected as it's a regular UNIX.
- If somebody wants to use CRLF on win32 he/she can run
% svn propset -R svn:eol-style native *
..but this is against line endings policy; important if he/she is planning to
commit.
--
regards / pozdrawiam,
Jaroslaw Staniek / OpenOffice Polska / Kexi Team
http://www.openoffice.com.pl | http://www.kexi-project.org
KDElibs/Windows: http://wiki.kde.org/tiki-index.php?page=KDElibs+for+win32
More information about the kde-core-devel
mailing list