case sensitivity on Windows

Mark Hammond mhammond at skippinet.com.au
Thu Oct 9 05:20:41 BST 2008


> Yes, there's hope of help from other bzr developers.  Maybe a good
> place to begin would be with a kind of doctest-ish description of what
> mappings are meant to occur and where.

After chatting with you on #bzr, I hope the following is what you have in
mind.  I'm posting it inline here and welcome any edits, and will eventually
post it somewhere near
http://bazaar-vcs.org/CaseInsensitiveWorkingTreeSupport.  I'm sure there are
a number of other scenarios which could be added, but the below is probably
enough to get started.

Also, FYI, I'm off for 10 days vacation in a couple of days, so you can
expect to not hear from me for that period - but I'll be back with a
vengeance ;)

Cheers,

Mark

----

This document attempts to describe the desired semantics for Bzr on a
Windows file system.  Most Windows file systems are "case preserving", in
that the original case given for a filename is retained, even though any
case can be used to access the file.  This is in contrast to some
file-systems, used on Windows and elsewhere, that are truly case-insensitve
(ie, where the original case is lost)
    
This document concerns itself mainly with the behaviour on a case-preserving
file system.

This document is intended to be in a "psuedo-doctest" format.  Lines
beginning with '%' are entered at a command-prompt, while lines beginning
with ">" are intended to show that command's output.  Where the desired
behaviour differs from the current behaviour is marked with lines starting
with '***'.

So, let's get started:

% [make and change into a temp working directory]
% bzr init

Windows is a case-preserving file-system.  Note that it doesn't matter what
case we use when asking for the file - we always get back the exact case the
file was created with.
    
% touch Foo
% dir foo
> ...
> 09/10/2008  01:40 PM                 0 Foo
% dir Foo
> ...
> 09/10/2008  01:40 PM                 0 Foo
% if exist Foo echo Yes
> Yes
% if exist foo echo Yes
> Yes

Bzr should attempt to use the name on the file-system rather than the name
supplied by the user.

% bzr add foo
*** current behaviour ***
> added foo
*** expected behaviour ***
> added Foo

% bzr status
*** current behaviour ***
> unknown:
>   Foo
*** expected behaviour ***
> added:
>  Foo

Supplying the incorrect case to a file already in the inventory should work
correctly.  Let's add a new file to bzr with the correct case:

% touch lower
% bzr add lower
> added lower

If Windows lets them see it with a given name:

% dir Lower
> ...
> 09/10/2008  01:48 PM                 0 lower

Bzr should too:

% bzr status Lower
*** current behaviour ***
> unknown:
>   Lower
*** expected behaviour ***
> added:
>   lower

All comments which accept a filename need to handle this situation.  Eg, rm:

% [make and change into a temp working directory]
% bzr init
> ...
% touch Foo lower
% bzr add
> added Foo
> added lower
% bzr ci -m "some changes"
> ...

% bzr rm foo Lower
*** current behaviour ***
> bzr: ERROR: Can't safely remove modified or unknown files:
> unknown:
>   foo
>   Lower
> Use --keep to not delete them, or --force to delete them regardless.
*** expected behaviour ***
> deleted lower
> deleted Foo

If an external program changes the case of the file underneath us, it must
not phase us.

% bzr revert
> +N  Foo
> +N  lower

% rm Foo
% echo hello > foo
% bzr status
*** current behaviour ***
> removed:
>   Foo
> unknown:
>   foo
*** expected behaviour ***
> modified:
>   Foo

And reverting a tree in that state should restore the case of the file:

% bzr revert
*** current behaviour ***
>  M  Foo
> Conflict adding file Foo.  Moved existing file to foo.moved.
*** expected behaviour ***
> M Foo





More information about the bazaar mailing list