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

Juliusz Chroboczek Juliusz.Chroboczek at pps.jussieu.fr
Thu Dec 14 06:44:11 PST 2006


Simon,

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.)

                                        Juliusz




More information about the darcs-devel mailing list