simpler approach

This commit is contained in:
Joey Hess 2011-02-09 01:01:06 -04:00
parent 2bd16f84ae
commit 62ebeb00d9

12
test.hs
View file

@ -11,7 +11,7 @@ import System.Directory
import System.Posix.Directory (changeWorkingDirectory) import System.Posix.Directory (changeWorkingDirectory)
import System.Posix.Files import System.Posix.Files
import IO (bracket_, bracket) import IO (bracket_, bracket)
import Control.Monad (unless, when) import Control.Monad (unless, when, filterM)
import Data.List import Data.List
import System.IO.Error import System.IO.Error
import System.Posix.Env import System.Posix.Env
@ -537,13 +537,11 @@ cleanup dir = do
e <- doesDirectoryExist dir e <- doesDirectoryExist dir
when e $ do when e $ do
-- git-annex prevents annexed file content from being -- git-annex prevents annexed file content from being
-- removed via permissions bits; undo -- removed via directory permissions; undo
recurseDir SystemFS dir >>= mapM_ fixmodes recurseDir SystemFS dir >>=
filterM doesDirectoryExist >>=
mapM_ Content.allowWrite
removeDirectoryRecursive dir removeDirectoryRecursive dir
where
fixmodes f = do
s <- getSymbolicLinkStatus f
unless (isSymbolicLink s) $ Content.allowWrite f
checklink :: FilePath -> Assertion checklink :: FilePath -> Assertion
checklink f = do checklink f = do