[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Detecting CR eol

From: Campbell Allan <campbell.allan_at_sword-ciboodle.com>
Date: Wed, 8 Sep 2010 16:27:09 +0100

On Wednesday 08 Sep 2010, Giulio Troccoli wrote:
> > I don't believe you have to go to so much trouble in the
> > pre-commit hook. If you have set the svn:eol-style property
> > then subversion will ensure the file has those line endings
> > on checkout and update them when committing into the
> > repository. So all the hook needs to do is check for the
> > property. See the book for more details
> >
> > http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.advan
> > ced.props.special.eol-style
>
> I'm not sure. Are you saying that if I set the svn:eol-style property to
> LF, for example, and my file has at least one line ending with CRLF, then
> Subversion will reject the commit? The book doesn't quite say that, and
> that wasn't my understanding on how the property works.
>

Before sending my previous reply I had tested it with a file changed using
unix2dos. Prior to the commit svn diff only shows the text changes ignoring
the line endings. I haven't explicitly tested changing a single line ending
within the file but have done a quick concatenation test with half the file
with LF and the other half CRLF. When committed the entire file in the
working copy is changed to LF.

The part of the book that I felt was relevant is when the line ending is set
to native subversion will store the file in the repository with LF's only.
The client is then changing this to reflect the preferences of the client OS.

> > I'd also normally expect the line ending style to be set to
> > native so windows and unix users don't trample the existing
> > incompatible line endings. The only reason perhaps for
> > checking each file explicitly would be if there was something
> > else needing the files to be in a particular format, ie
> > releases to customers from a developer machine rather than an
> > official build server that would check out a clean copy each time.
>
> The requirement, to have LF, came a long time ago. I remeber having
> problems with svn:eol-style set to native. I think Subversion did not
> checkout the files with the correct EOL based on the platform, but maybe
> that was because the files were actually being committed with mixed EOLs.
>
> G
>
>
> Linedata Limited
> Registered Office: 85 Gracechurch St., London, EC3V 0AA
> Registered in England and Wales No 3475006 VAT Reg No 710 3140 03

This may have occurred if the property was set after the files had been
versioned with the mixed line endings but I'm only guessing. Whenever I've
set the property I've also ran the dos2unix command on the files. We've not
noticed any problems with the value being set to native and we're running a
fairly old server (1.4.6) with mainly 1.5 clients.

-- 
__________________________________________________________________________________
Sword Ciboodle is the trading name of ciboodle Limited (a company 
registered in Scotland with registered number SC143434 and whose 
registered office is at India of Inchinnan, Renfrewshire, UK, 
PA4 9LH) which is part of the Sword Group of companies.
This email (and any attachments) is intended for the named
recipient(s) and is private and confidential. If it is not for you, 
please inform us and then delete it. If you are not the intended 
recipient(s), the use, disclosure, copying or distribution of any 
information contained within this email is prohibited. Messages to 
and from us may be monitored. If the content is not about the 
business of the Sword Group then the message is neither from nor 
sanctioned by us.
Internet communications are not secure. You should scan this
message and any attachments for viruses. Under no circumstances
do we accept liability for any loss or damage which may result from
your receipt of this email or any attachment.
__________________________________________________________________________________
Received on 2010-09-08 17:28:19 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.