[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: Fri, 25 Mar 2011 14:14:05 +0100

On Fri, Mar 25, 2011 at 1:43 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Johan Corveleyn <jcorvel_at_gmail.com> writes:
>
>> C:\Temp\test>dir /B
>> ToDo
>>
>> C:\Temp\test>move todo todo
>>
>> C:\Temp\test>dir /B
>> todo
>
> So "svn mv todo todo" will be a case-only rename, I guess that's OK if
> it is what users expect.
>
> What if the file is already lower-case "todo"?  Subversion is happy to
> do
>
>  svn rm todo
>  svn cp todo_at_base todo
>
> to generate a replace on commit.  Should "svn mv todo todo" generate a
> replace when the file is already "todo"?

Good question. I'm not sure.

There are two other options that I can think of (let's call your
suggestion option 1)):

2) svn could just ignore the no-op move, and do nothing (no warning,
no error, nothing).

3) svn could error out, like it does now, with "Cannot move path
'XXX/todo' into itself"

I think 2) would be more "the Windows way", so if we are aiming for
platform-fidelity here, that would be my choice.

Again, looking at the native "move" command on Windows, we can see
that "move todo todo" acts as if it has done a move, but really didn't
do anything, not even "touch" the file or the parent dir. OTOH, if we
do a real case-only rename, "move todo TODO", the timestamp of the
parent dir is updated (i.e., it really has changed). See below.

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

C:\Temp\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 98BA-E619

 Directory of C:\Temp\test

25/03/2011 13:57 <DIR> .
25/03/2011 13:57 <DIR> ..
25/03/2011 13:57 7 todo
               1 File(s) 7 bytes
               2 Dir(s) 2.945.830.912 bytes free

C:\Temp\test>time /t
13:59

C:\Temp\test>move todo todo
        1 file(s) moved.

C:\Temp\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 98BA-E619

 Directory of C:\Temp\test

25/03/2011 13:57 <DIR> .
25/03/2011 13:57 <DIR> ..
25/03/2011 13:57 7 todo
               1 File(s) 7 bytes
               2 Dir(s) 2.945.384.448 bytes free

C:\Temp\test>move todo TODO
        1 file(s) moved.

C:\Temp\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 98BA-E619

 Directory of C:\Temp\test

25/03/2011 14:00 <DIR> .
25/03/2011 14:00 <DIR> ..
25/03/2011 13:57 7 TODO
               1 File(s) 7 bytes
               2 Dir(s) 2.945.363.968 bytes free
]]]

Cheers,

-- 
Johan
Received on 2011-03-25 14:14:58 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.