4 # For issue600, testing optimize --relink
8 ## We don't support hard links on Windows.
10 if echo $OS |
grep -i windows
; then
11 echo darcs does not support hard links on Windows
15 ## compare succeeds if there are hard links
17 echo 'use File::Basename; $res=0; while ($fn=<'$1'/*>) { $fn2="'$2'/" . basename($fn); @fd1=lstat($fn); @fd2=lstat($fn2); $res += ($fd1[1] != $fd2[1]);}; exit($res);' | perl
25 darcs init
--repodir x
29 darcs record
-a -A me
-m 'addfoo'
32 ## Does the filesystem support hard linking at all?
36 if ! ln z
1/foo z
2/foo
; then
37 echo No
ln command for `pwd`; assuming no hard links.
40 if ! compare z1 z2
; then
41 echo Filesystem
for `pwd` does not support hard links.
44 # workaround for SunOS cp which does not support `-a' option but also
45 # doesn't fail when it is encountered.
48 ## Now try relinking using darcs.
50 darcs optimize
--verbose --relink --repodir x
--sibling y
51 rm -rf x
/_darcs
/patches
/pend
* y
/_darcs
/patches
/pend
*
52 if compare x
/_darcs
/patches y
/_darcs
/patches
53 then echo darcs
--relink is working
, hard links were
done.
54 else echo darcs
--relink is not working
, it did not
make any hard links.