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

Re: svn add and inconsistent line endings

From: Branko ÄŒibej <brane_at_wandisco.com>
Date: Sun, 24 Feb 2013 19:42:22 +0100

On 24.02.2013 19:29, Bert Huijben wrote:
>
>> -----Original Message-----
>> From: Stefan Küng [mailto:tortoisesvn_at_gmail.com]
>> Sent: zondag 24 februari 2013 19:15
>> To: Bert Huijben
>> Cc: 'Subversion Development'
>> Subject: Re: svn add and inconsistent line endings
>>
>> On 24.02.2013 18:56, Bert Huijben wrote:
>>>
>>>> -----Original Message-----
>>>> From: Stefan Küng [mailto:tortoisesvn_at_gmail.com]
>>>> Sent: zondag 24 februari 2013 17:01
>>>> To: Bert Huijben
>>>> Cc: 'Subversion Development'
>>>> Subject: Re: svn add and inconsistent line endings
>>>>
>>>> On 24.02.2013 16:47, Bert Huijben wrote:
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Stefan Küng [mailto:tortoisesvn_at_gmail.com]
>>>>>> Sent: zondag 24 februari 2013 15:39
>>>>>> To: Subversion Development
>>>>>> Subject: svn add and inconsistent line endings
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> When auto-props are set up for e.g., cpp files that set the
>>>>>> svn:eol-style property, adding those files is not possible if the
> file
>>>>>> has inconsistent line endings.
>>>>>> The --force flag won't help either, the only way to add the file is
> to
>>>>>> first fix the line endings in an editor.
>>>>>> Or add the file with --no-auto-props and then add the properties
> later.
>>>>>> I think this situation is not good.
>>>>>> Maybe another param added to svn_client_add5 that ignores the EOL
>>>> check?
>>>>>> Or just pass the 'force' flag on to svn_wc__canonicalize_props()
>>> instead
>>>>>> of passing 'false' unconditionally in libsvn_wc\adm_ops.c,
>>>>>> svn_wc_add_from_disk2() ?
>>>>> I don't think simply ignoring this and allowing the add to continue is
> a
>>>>> good enough solution.
>>>>>
>>>>> Just passing the skip checks flags will allow adding many wrong
>>> properties
>>>>> which will cause a lot of grief later, and I would guess adding the
> file
>>>>> would just delay the error until we try to commit this file.
>>>>>
>>>>>
>>>>> But looking at this from the AnkhSVN side, I would like to have some
> api
>>> to
>>>>> make the eols on files consistent... Would this work for you?
>>>> The API already exists, since when passing the --force flag to the
>>>> propset command (adding the svn:eol-style property), then the file is
>>>> automatically adjusted.
>>> Are you sure the file is adjusted?
>>>
>>> Looking at the code it appears we just skip the check (and many others
> for
>>> other properties).
>> You're right. And I just tested: even if the property is set (indicating
>> inconsistent eols should be either ignored or corrected), a commit for
>> such a file fails as well.
>>
>> Maybe someone can explain why that check is needed? Is there really a
>> situation where the svn:eol-style property is set on a file and users
>> don't want the inconsistencies in eols either ignored or fixed
>> automatically? I can't think of one such situation.
>> Because if there isn't, then why not remove that check?
> (Just added a regression test to confirm)
>
> In that case I would say that we should remove the file contents check on
> the local propset and leave the problem to the later commit.
> That should fix all the property problems for autoprops Branko, shouldn't
> it?

Yup, it should. I'm just not sure what happens during commit then.

> I think we should still verify that the property values are valid to make it
> visible that the autoprops are not set correctly.

Agreed. Which reminds me that I should verify that the reserved property
name checking extend to auto-props as well. (And make sure it's used
when --with-revprop is specified, but that's another story.)

> But that leaves the problem that it would be nice to have an easy fix for
> subversion clients to resolve these eol problems while committing...

Precisely. Interestingly enough, I don't thing Subversion (at least the
command-line client) provides an easy way to do that.

Regarding automatcially changing line endings -- we don't do that for a
very good reason: it's always been Subversion's policy to not touch file
contents unless explicitly told to do so. The line endings could be
inconsistent for reasons beyond Subversion's knowledge, and the property
might have been set erroneously. It's therefore up to the user to make
sure which is the case.

(We're talking about adding files here, of course. Once a file is
committed, svn:eol-style does tell the client to fiddle with the line
endings.)

-- Brane

-- 
Branko ÄŒibej
Director of Subversion | WANdisco | www.wandisco.com
Received on 2013-02-24 19:43:09 CET

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

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