Thursday, February 01, 2007

Case sensitivity, SVN and Windows is a recipe for disaster

We are working on a project at work that has four developers working against the SVN repository in Visual Studio.NET 2005.  The other day I had to create a new project in the solution.  I got it all set up and committed the project into the repository using Ankh, great.  I started to close down for the day and in explorer I noticed that there were still files that were flagged that they needed to be committed.  Looking at it, it was the project file that needed to be committed. So I right clicked and committed it with Tortoise.

Yesterday another developer was trying to checkout the repository to his computer and they ran into an error trying to load the project I had committed.  I was roughly told that it was my project file was missing.  They were able to work around it because the project I committed wasn't needed to work on what they needed.  So I took note of it and would look into it when I had a chance.

Fast forward to this morning.  Based on the feedback I had been given I went into explorer to see if the project file was indeed the one that needed to be added to the repository.  But it showed that it was already committed.  Hmm...so I went to the developer and asked him to forward me the error messages he was getting when updating.

Here was ankh's message:
NSvn.Core.SvnClientException:
Failed to add file '[Path to file]\Web.config': object of the same name already exists
at NSvn.Core.Client.Update(String[] paths, Revision revision, Recurse recurse, Boolean ignoreExternals) in d:\tmp\build-2\src\nsvn.core\client.cpp:line 356
at Ankh.Commands.UpdateItem.UpdateRunner.Work(IContext context) in D:\tmp\build-2\src\Ankh\Commands\UpdateItemCommand.cs:line 131
at Ankh.ProgressRunner.Run() in D:\tmp\build-2\src\Ankh\ProgressRunner.cs:line 95
Same file conflict?  That didn't make any sense.  We started speculating.  I run different a different version of Tortoise on my machine then everyone else and thus my client version of Subversion is newer then the server and everyone else.  But I've been running like this for weeks with no problems up to this point.

I have the developer try checking out a project that only I worked on for another client in the past couple of days.  He said he had no problems getting those files.

He then went back and tried to update the original problem project from Tortoise and pasted the errors he got:
Error: In directory '[Directory Path Specified]'
Error: Can't copy '[Path Specified]\.svn\tmp\text-base\web.config.svn-base' to '[Path specified]\web.config.tmp': The system cannot find the file specified.
I went and googled for "Can't copy '': The system cannot find the file specified." the results led me to this explaination.
There are actually 2 different files in the repository whose names differ only in case. This cannot work on a Windows checkout, because the Windows file system is not case-sensitive. It is likely that one of the files got added by mistake, so you need to find out which one, make sure there are no changes committed to the wrong file, then delete it.
I went to our Trac site and looked at the source files and sure enough there was web.config and Web.config files listed.  Going back to Visual Studio.Net and Explorer I noticed that Visual Studio.NET had the Web.config and Explorer had the web.config. 

Here is the solution I came up with, there's probably a better way of doing this and I'd love to hear about them in the comments but this solution did work.  I made a backup of the Web.config file and then I deleted the Web.config in VS.NET and committed my changes. Looking in Trac again I see that I am down to just web.config in the repository.  I figure at this point I can just update and use that single version of web.config but I got the same error as above.

I close Visual Studio and open up Tortoises Repository Browser and I delete web.config. I then delete the whole project folder out of explorer (you have to do this because the svn folders have the web.config still listed in it's cache and you'll get the same errors). 

After the folder had been deleted I reopened Visual Studio.NET and opened the solution.  After I updated the solution from the repository I added my backed up copy of web.config (with the proper case that I am looking for) into the project and committed it.  Everything now had the right case, Visual Studio, Explorer and trac (which is the SVN Repository version). 

I went to the other developers and after they committed all the work they were doing they closed out of Visual Studio. Deleted the problem project folder in Explorer.  Reopened the solution in VS and updated and refreshed the project with a now working copy.

So make sure if you're working with a SVN client in Windows against a Linux based SVN repository that you have the same case throughout or you'll need to fix it.  And so far the only way to fix it is a manual process.

Thursday, May 17, 2007 8:09:20 PM (Eastern Daylight Time, UTC-04:00)
Hi there,

I just thought I'd mention that this isn't specific to Linux-based SVN repositories. You'll get the same issue if the repository is running on a Windows machine.

Cheers.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u)  

Enter the code shown (prevents robots):

Blog Posts by:

Currently Viewable:

My Twitter Updates

View Twitter Page