[darcs-devel] Re: darcs patch: Windows hard link support

Simon Marlow simonmar at microsoft.com
Thu Dec 14 07:06:18 PST 2006


Juliusz Chroboczek wrote:
> Looking further at your patch, I'm not quite sure whether you're
> looking at the right place.  Please forgive me if the below is
> obvious for you.
>
> There are two places where Darcs will create hard links: (1) when
> doing``darcs get'' on a local filesystem, and (2) when runninng
> ``darcs optimize --relink''.
>
> The function maybe_relink, which is the one you tried to patch, is
> only used by (2).  Now (1) is implemented differently: it calls
> copyFilesOrUrls, which in turn calls copyLocals, which in turn calls
> copyLocal which is in External.hs and is implemented as so:
>
>   copyLocal fou out = createLink fou out `catchall` cloneFile fou out
>
>   cloneFile source dest = readFilePS source >>= writeFilePS dest
>
> So in order to get hard links on Windows when doing ``darcs get'',
> you've got two solutions -- you can either implement
> System.Posix.Files.createLink on Windows within the Ghc libraries
> (surely the preferred solution), or provide us with an implentation of
> createLink that works under Windows and that we'll substitute for
> Ghc's version within Darcs.
>
> (In case you find yourself confused by the package structure: there's
> an extra indirection through a module ``Workaround'' which is
> generated by configure.)

Thanks Juliusz - actually I did realise this after I submitted the patch.  One reason for the confusion was that I timed a 'darcs get' from a local repo using my installed darcs against the newly built one, and the new one was much faster, so I declared success :-)   I guess the speedup must be due to something else - maybe the System.Process switch that was also in my local copy.

Cheers,
        Simon




More information about the darcs-devel mailing list