You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Chris Weiss <cw...@stickyc.com> on 2005/05/26 21:14:31 UTC

Avoiding duplicate filenames in repository

We ran into an interesting situation where two different Windows clients 
both added files with identical filenames but different capitalization 
(IE, file1.JPG and file1.jpg). Since *nix considers these two seperate 
filenames, we ended up with both files added to the repository. However, 
when trying to do a checkout or update, Windows would consider them the 
same filename and TortoiseSVN would report being unable to create the 
file. Since the filenames were legal, svnadmin recover/verify didn't see 
anything wrong. It wasn't until I browsed the repository with 
TortoiseSVN (we're using svnserve only as we can't put apache2 on our 
cohosted server) that I noticed there were two files and was able to 
delete one of them.

Is there any way of preventing this in the future? Since that's the 
nature of *nix/Windows interaction, I realize it's not a bug to be 
fixed, but it sure would be nice to have TortoiseSVN check for potential 
conflicts in the repository before allowing an add like that.

-- 
This message has been scanned for viruses and
dangerous content, and is believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Avoiding duplicate filenames in repository

Posted by Max Bowsher <ma...@ukf.net>.
Greg Thomas wrote:
> On Thu, 26 May 2005 14:14:31 -0700, Chris Weiss <cw...@stickyc.com>
> wrote:
>
>> Is there any way of preventing this in the future?
>
> Sounds like a case for a pre-commit hook.

An example for which exists:

http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/check-case-insensitive.pl

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Avoiding duplicate filenames in repository

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 26 May 2005 14:14:31 -0700, Chris Weiss <cw...@stickyc.com>
wrote:

>Is there any way of preventing this in the future?

Sounds like a case for a pre-commit hook. On an 'Add', simply do a
case-insentivive check for another matching filename.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Avoiding duplicate filenames in repository

Posted by Christopher Ness <ch...@nesser.org>.
On Thu, 2005-05-26 at 14:14 -0700, Chris Weiss wrote:
> We ran into an interesting situation where two different Windows clients 
> both added files with identical filenames but different capitalization 
> (IE, file1.JPG and file1.jpg). Since *nix considers these two seperate 
> filenames, we ended up with both files added to the repository. However, 
> when trying to do a checkout or update, Windows would consider them the 
> same filename and TortoiseSVN would report being unable to create the 
> file. Since the filenames were legal, svnadmin recover/verify didn't see 
> anything wrong. It wasn't until I browsed the repository with 
> TortoiseSVN (we're using svnserve only as we can't put apache2 on our 
> cohosted server) that I noticed there were two files and was able to 
> delete one of them.
> 
> Is there any way of preventing this in the future? Since that's the 
> nature of *nix/Windows interaction, I realize it's not a bug to be 
> fixed, but it sure would be nice to have TortoiseSVN check for potential 
> conflicts in the repository before allowing an add like that.

To expand Greg's message a bit, perhaps you could try.

A pre-commit script that uses `grep -i` and `svnlook` to look for
similar file names should work.  An excerpt from the grep man page:

       -i, --ignore-case
              Ignore case distinctions in  both  the  PATTERN  and  the  input
              files.

Write your error message to STDERR to be returned to the client and exit
with a non zero code to reject a commit.

Be sure not to reject /trunk/file.JPG when /tags/file.jpg exists (check
the full path!) 

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger.localdomain
11:38:45 up 2 days, 1:23, 1 user, load average: 0.01, 0.01, 0.00


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org