[PATCH V2] clone: allow clones into effectively empty directories

Jason Harris jason.f.harris at gmail.com
Tue Apr 5 07:12:58 CDT 2011


On Apr 5, 2011, at 1:46 PM, Frank Kingswood wrote:

> On 05/04/11 11:58, Jason Harris wrote:
>> # HG changeset patch
>> # User jfh<jason at jasonfharris.com>
>> # Date 1301985969 -7200
>> # Node ID 730ee0bb855649b63c93318434e657b3432fa1dd
>> # Parent  0995eee8ffe4a24478379fb16fd6c38812bc3dd5
>> clone: allow clones into effectively empty directories
>> 
>> In OSX many empty directories actually have a '.DS_Store' file
>> in them, which is effectively ignored by lots of things.  The
>> presence of this .DS_Store file shouldn't mean that the directory
>> is treated as though it really has stuff in it.
>> 
>> Similarly, ignore the thumbs.db and desktop.ini files for windows
>> support.
> 
> This is getting far too magic for my liking. What if someone actually has such a file in his repository?

It doesn't matter if such a file is in a repository. The question is: if you clone into a directory and the directory is to all essentially purposes empty. Should we still bail even if there is OS cruft in the directory? Right now if its totally empty then Mercurial allows the clone into the directory. This patch changes things so that if there is a directory and it *only* contains something like a '.DS_Store' file it means that the user has created this in the OSX finder and we should be able to clone a repo *into* that directory, and so we allow the clone. (It certainly is not hard to imagine a user creating a folder in the windows explorer or the OSX finder and then wanting to clone into it...)

(Actually I created this patch in response to: https://bitbucket.org/jfh/machg/issue/222)

Its not of course a critical issue, and maybe we would want these files to be platform specific? Certainly the case of anyone ever having a single directory with the file .DS_Store in windows or linux and them actually storing useful information in this single file is pretty vanishingly small...


> Really this is just a change to allow users to avoid the stop-and-think when overwriting a directory -- it is not really all that much work to delete a directory.

Its a small detail, but it smooths the process on OSX, for users. A good UI just does such things unobtrusively and without hassling the user.

Cheers,
  Jas


More information about the Mercurial-devel mailing list