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

Re: Case-only renames on Windows (issue #3702)

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Thu, 24 Mar 2011 22:08:41 +0100

2011/3/24 Branko Čibej <brane_at_e-reka.si>:
> On 24.03.2011 15:22, Philip Martin wrote:
>> Johan Corveleyn <jcorvel_at_gmail.com> writes:
>>
>>> I'm looking at issue #3702 ("svn ren TODO todo" not work on windows).
>> It's a bit tricky :)  Consider a mixed-case node "Foo".  It's seems
>> obvious that
>>
>>    svn mv Foo foo
>>
>> is a case-only rename.  But what about
>>
>>    svn mv FOO foo
>>
>> or
>>    svn mv foo foo
>>
>> It's possible to do a case-only rename whenever the destination doesn't
>> match the disk, but should we require the source to match?
>
> Clearly not ... case-only rename on a case-inseneitive file-system
> assumes that the file-system is case-insensitive. :)
>
>> The node "Foo" might contain a child "Zig", is
>>
>>    svn mv Foo/Zig foo/Zig
>
> That's a no-op. You've not renamed Zig.
>
>> a case-only rename?  If that is a case-only rename what about
>>
>>    svn mv Foo/Zig foo/zig
>
> That's a case-only rename of Foo/Zig to Foo/zig.
>
>> is that two renames?  Suppose there are two children "Zig" and "Zag",
>> if
>>
>>    svn mv Foo/Zig foo/Zig
>>
>> is a case-only rename it would affect "Foo/Zag".
>
> You're really piling it on here, starting from wrong premises. :)
> A rename affects the last component of a path, nothing more. I've never
> heard of a system when you can case-only rename a directory in the
> middle of a path.
>
> In short, things aren't /that/ tricky as far as renames go. They're a
> lot trickier during update and commit, if the editor hits a local file
> that has the wrong case on-disk, but is otherwise versioned (I've known
> brain-dead tools to case-only rename the files they'd worked on).

Philip, Brane,

Thanks for thinking this through. I hadn't actually thought that far.

I think Brane is right:
- The source path should handled case-insensitively. If it matches
case-insensitively with the source path, that's the path that will be
affected by the move. The case of the target path is then taken "as
is" for the rename/move.
- Rename only affects the last component of a path

I think this is the correct behavior on Windows, because that's the
way the native "move" command behaves:

[[[
C:\Temp\test>echo test > TODO

C:\Temp\test>dir /B
TODO

C:\Temp\test>move toDo ToDo

C:\Temp\test>dir /B
ToDo

C:\Temp\test>move todo todo

C:\Temp\test>dir /B
todo

C:\Temp\test>cd ..

C:\Temp>move TEST\TOdo tEsT\toDO

C:\Temp>dir /B
test

C:\Temp>dir /B test
toDO
]]]

Cheers,

-- 
Johan
Received on 2011-03-24 22:09:32 CET

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