summaryrefslogtreecommitdiff
path: root/Annex/Content/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-15 16:37:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-15 16:37:57 -0400
commit186732d10740fec3b29751a6076c60148e3479f7 (patch)
treea218c74c1f9fefe14a23beabc2ca46e5f4afc158 /Annex/Content/Direct.hs
parentecd610e955e0cfa5c88535039f434ea2a299068c (diff)
Revert "Clean up direct mode cache and mapping info when dropping keys."
This reverts commit f797939d15a2b414e62b28ccb0bd9e5b77978d76. This was buggy, it caused the direct mode cache to be lost when dropping keys, so when the file is gotten back, it's stored in indirect mode. Note to self: Do not attempt bug fixes at 6 am!
Diffstat (limited to 'Annex/Content/Direct.hs')
-rw-r--r--Annex/Content/Direct.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs
index 07edb4dd9..e38fc23ce 100644
--- a/Annex/Content/Direct.hs
+++ b/Annex/Content/Direct.hs
@@ -15,6 +15,7 @@ module Annex.Content.Direct (
updateInodeCache,
writeInodeCache,
compareInodeCache,
+ removeInodeCache,
toInodeCache,
) where
@@ -119,5 +120,11 @@ writeInodeCache key cache = withInodeCacheFile key $ \f -> do
createContentDir f
liftIO $ writeFile f $ showInodeCache cache
+{- Removes an inode cache. -}
+removeInodeCache :: Key -> Annex ()
+removeInodeCache key = withInodeCacheFile key $ \f -> do
+ createContentDir f -- also thaws directory
+ liftIO $ nukeFile f
+
withInodeCacheFile :: Key -> (FilePath -> Annex a) -> Annex a
withInodeCacheFile key a = a =<< inRepo (gitAnnexInodeCache key)