summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-30 19:09:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-30 19:09:36 -0400
commit292a3e8c38de26dc1be2494ab6a3b8ebbf411b8b (patch)
tree561879b260c201a4659b0291cb3742be2cfb694d
parent9c1c244d99d5e543cc1e064a629444ddcb07b9b0 (diff)
refactor
-rw-r--r--Annex/Content.hs9
-rw-r--r--Annex/Perms.hs5
2 files changed, 8 insertions, 6 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 0f9c4acdf..6e040b9ac 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -353,8 +353,7 @@ removeAnnex :: Key -> Annex ()
removeAnnex key = withObjectLoc key remove removedirect
where
remove file = do
- unlessM crippledFileSystem $
- liftIO $ allowWrite $ parentDir file
+ thawContentDir file
liftIO $ nukeFile file
removeInodeCache key
cleanObjectLoc key
@@ -374,8 +373,7 @@ removeAnnex key = withObjectLoc key remove removedirect
fromAnnex :: Key -> FilePath -> Annex ()
fromAnnex key dest = do
file <- calcRepo $ gitAnnexLocation key
- unlessM crippledFileSystem $
- liftIO $ allowWrite $ parentDir file
+ thawContentDir file
thawContent file
liftIO $ moveFile file dest
cleanObjectLoc key
@@ -388,8 +386,7 @@ moveBad key = do
bad <- fromRepo gitAnnexBadDir
let dest = bad </> takeFileName src
createAnnexDirectory (parentDir dest)
- unlessM crippledFileSystem $
- liftIO $ allowWrite (parentDir src)
+ thawContentDir src
liftIO $ moveFile src dest
cleanObjectLoc key
logStatus key InfoMissing
diff --git a/Annex/Perms.hs b/Annex/Perms.hs
index dc1cb2f8b..f5925b741 100644
--- a/Annex/Perms.hs
+++ b/Annex/Perms.hs
@@ -12,6 +12,7 @@ module Annex.Perms (
noUmask,
createContentDir,
freezeContentDir,
+ thawContentDir,
) where
import Common.Annex
@@ -87,6 +88,10 @@ freezeContentDir file = unlessM crippledFileSystem $
go AllShared = groupWriteRead dir
go _ = preventWrite dir
+thawContentDir :: FilePath -> Annex ()
+thawContentDir file = unlessM crippledFileSystem $
+ liftIO $ allowWrite $ parentDir file
+
{- Makes the directory tree to store an annexed file's content,
- with appropriate permissions on each level. -}
createContentDir :: FilePath -> Annex ()