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

Re: How to fix issue #4023 (on Windows, 'svn rm missingItem' deletes the unversioned 'MissingItem' from disk)?

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Wed, 25 Jan 2012 11:12:04 +0100

On Wed, Jan 25, 2012 at 9:52 AM, Branko Čibej <brane_at_xbc.nu> wrote:
> On 24.01.2012 15:15, Philip Martin wrote:
>> Daniel Shahaf <danielsh_at_elego.de> writes:
>>
>>>>   Given three files "foo", "FOO" and "Foo", one in
>>>>   wc.db, one on disk and one on the command line, is that the same file?
>>>>
>>>> My understanding is that a Windows user expects those to be the same
>>>> file.  So "svn st FOO", "svn st foo" and "svn st Foo" all refer to the
>>>> file in wc.db and the file on disk even though the cases don't match.
>>> But normal windows programs don't have the concept of "one on disk and
>>> one in wc.db". And I imagine we want to have some syntax to refer to the
>>> latter.
>> What I meant was names rather than files.  So one of foo/FOO/Foo in
>> wc.db, another on disk and another on the command line.
>
> You are complicating the issue far more than necessary. Assuming the
> owner of the repository knows that there are going to be windows
> clients, the case you describe is not going to happen in the first
> place. Even Unix-centric repositories will not likely or often have
> names in the same directory that differ only in case.
>
> It's far more likely that there's foo in the wc.db, FOO on dist, and the
> user types Foo. The solution to this most common case is blindingly
> obvioius, but quite hard to do right because one can't really do
> case-insensitive queries into the wc.db, and certainly not with the same
> case folding rules that the filesystem uses (yes, especially with NTFS
> which most everybody uses these days, there's no guarantee that the FS
> will case-fold in the same way as the currently active locale).
>
> The reasonable solution would be:
>
>  * if the name exists in the wc.db but not on disk, try to
>    case-normalize to the on-disk form  (and, possibly, case-rename to
>    the wc.db form on the fly)
>  * if the name does /not/ exist in wc.db, still try to case-normalize
>    to the on-disk form, then scan the directory info in wc.db and see
>    if any name in there can be normalized to the same on-disk form. If
>    there's exactly one, use that and proceed as above. If there are
>    more than one, cry for help.

I'm sorry, but I think the current fix for #3865 is a much better
solution, because there is no need to cry for help if there are
multiple matches in wc.db (modulo case):

* If there is an exact match in wc.db, use that. Forget about the disk
  (if there is a case-clashing item on disk, it's a different item. It's
  always been that way in the svn world on case-insensitive FS's)
* If not, try to case-normalize to an on-disk file.

Though the FS is case-insensitive, wc.db, even on Windows, is
case-sensitive. It simply *has* to be, because otherwise there would
be no way to do a case-only rename (or to represent two totally
unrelated items which case-clash but have to be represented in wc.db
at the same time, because they came in through a merge or something).
So it makes no sense to pretend that items in wc.db which
case-normalize to the same file are the same items.

-- 
Johan
Received on 2012-01-25 11:13:19 CET

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