refactor
This commit is contained in:
parent
7c73b7584d
commit
11ca4cee34
2 changed files with 8 additions and 6 deletions
|
@ -353,8 +353,7 @@ removeAnnex :: Key -> Annex ()
|
||||||
removeAnnex key = withObjectLoc key remove removedirect
|
removeAnnex key = withObjectLoc key remove removedirect
|
||||||
where
|
where
|
||||||
remove file = do
|
remove file = do
|
||||||
unlessM crippledFileSystem $
|
thawContentDir file
|
||||||
liftIO $ allowWrite $ parentDir file
|
|
||||||
liftIO $ nukeFile file
|
liftIO $ nukeFile file
|
||||||
removeInodeCache key
|
removeInodeCache key
|
||||||
cleanObjectLoc key
|
cleanObjectLoc key
|
||||||
|
@ -374,8 +373,7 @@ removeAnnex key = withObjectLoc key remove removedirect
|
||||||
fromAnnex :: Key -> FilePath -> Annex ()
|
fromAnnex :: Key -> FilePath -> Annex ()
|
||||||
fromAnnex key dest = do
|
fromAnnex key dest = do
|
||||||
file <- calcRepo $ gitAnnexLocation key
|
file <- calcRepo $ gitAnnexLocation key
|
||||||
unlessM crippledFileSystem $
|
thawContentDir file
|
||||||
liftIO $ allowWrite $ parentDir file
|
|
||||||
thawContent file
|
thawContent file
|
||||||
liftIO $ moveFile file dest
|
liftIO $ moveFile file dest
|
||||||
cleanObjectLoc key
|
cleanObjectLoc key
|
||||||
|
@ -388,8 +386,7 @@ moveBad key = do
|
||||||
bad <- fromRepo gitAnnexBadDir
|
bad <- fromRepo gitAnnexBadDir
|
||||||
let dest = bad </> takeFileName src
|
let dest = bad </> takeFileName src
|
||||||
createAnnexDirectory (parentDir dest)
|
createAnnexDirectory (parentDir dest)
|
||||||
unlessM crippledFileSystem $
|
thawContentDir src
|
||||||
liftIO $ allowWrite (parentDir src)
|
|
||||||
liftIO $ moveFile src dest
|
liftIO $ moveFile src dest
|
||||||
cleanObjectLoc key
|
cleanObjectLoc key
|
||||||
logStatus key InfoMissing
|
logStatus key InfoMissing
|
||||||
|
|
|
@ -12,6 +12,7 @@ module Annex.Perms (
|
||||||
noUmask,
|
noUmask,
|
||||||
createContentDir,
|
createContentDir,
|
||||||
freezeContentDir,
|
freezeContentDir,
|
||||||
|
thawContentDir,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
|
@ -87,6 +88,10 @@ freezeContentDir file = unlessM crippledFileSystem $
|
||||||
go AllShared = groupWriteRead dir
|
go AllShared = groupWriteRead dir
|
||||||
go _ = preventWrite 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,
|
{- Makes the directory tree to store an annexed file's content,
|
||||||
- with appropriate permissions on each level. -}
|
- with appropriate permissions on each level. -}
|
||||||
createContentDir :: FilePath -> Annex ()
|
createContentDir :: FilePath -> Annex ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue