diff options
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 10 | ||||
-rw-r--r-- | Annex/Content/Direct.hs | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 87ff3f692..8be2cf008 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -28,6 +28,7 @@ module Annex.Content ( freezeContent, thawContent, replaceFile, + cleanObjectLoc, ) where import System.IO.Unsafe (unsafeInterleaveIO) @@ -334,7 +335,12 @@ withObjectLoc key indirect direct = ifM isDirect cleanObjectLoc :: Key -> Annex () cleanObjectLoc key = do file <- inRepo $ gitAnnexLocation key - liftIO $ removeparents file (3 :: Int) + liftIO $ do + let dir = parentDir file + void $ catchMaybeIO $ do + allowWrite dir + removeDirectoryRecursive dir + removeparents dir (2 :: Int) where removeparents _ 0 = noop removeparents file n = do @@ -356,8 +362,8 @@ removeAnnex key = withObjectLoc key remove removedirect cleanObjectLoc key removedirect fs = do cache <- recordedCache key - removeCache key mapM_ (resetfile cache) fs + cleanObjectLoc key resetfile cache f = whenM (compareCache f cache) $ do l <- calcGitLink f key top <- fromRepo Git.repoPath diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index ec99c1ef4..9e917cf68 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -15,7 +15,6 @@ module Annex.Content.Direct ( recordedCache, compareCache, writeCache, - removeCache, genCache, toCache, Cache(..), @@ -129,12 +128,6 @@ writeCache key cache = withCacheFile key $ \cachefile -> do createContentDir cachefile liftIO $ writeFile cachefile $ showCache cache -{- Removes a cache. -} -removeCache :: Key -> Annex () -removeCache key = withCacheFile key $ \f -> do - createContentDir f -- also thaws directory - liftIO $ nukeFile f - {- Cache a file's inode, size, and modification time to determine if it's - been changed. -} data Cache = Cache FileID FileOffset EpochTime |