ensure that content directory is thawed when writing direct mode mapping and cache files
This commit is contained in:
parent
21a7ab4592
commit
103b572d8e
4 changed files with 37 additions and 34 deletions
|
@ -27,8 +27,6 @@ module Annex.Content (
|
|||
preseedTmp,
|
||||
freezeContent,
|
||||
thawContent,
|
||||
freezeContentDir,
|
||||
createContentDir,
|
||||
replaceFile,
|
||||
) where
|
||||
|
||||
|
@ -457,27 +455,3 @@ thawContent file = liftIO . go =<< fromRepo getSharedRepository
|
|||
go GroupShared = groupWriteRead file
|
||||
go AllShared = groupWriteRead file
|
||||
go _ = allowWrite file
|
||||
|
||||
{- Blocks writing to the directory an annexed file is in, to prevent the
|
||||
- file accidentially being deleted. However, if core.sharedRepository
|
||||
- is set, this is not done, since the group must be allowed to delete the
|
||||
- file.
|
||||
-}
|
||||
freezeContentDir :: FilePath -> Annex ()
|
||||
freezeContentDir file = liftIO . go =<< fromRepo getSharedRepository
|
||||
where
|
||||
dir = parentDir file
|
||||
go GroupShared = groupWriteRead dir
|
||||
go AllShared = groupWriteRead dir
|
||||
go _ = preventWrite dir
|
||||
|
||||
{- Makes the directory tree to store an annexed file's content,
|
||||
- with appropriate permissions on each level. -}
|
||||
createContentDir :: FilePath -> Annex ()
|
||||
createContentDir dest = do
|
||||
unlessM (liftIO $ doesDirectoryExist dir) $
|
||||
createAnnexDirectory dir
|
||||
-- might have already existed with restricted perms
|
||||
liftIO $ allowWrite dir
|
||||
where
|
||||
dir = parentDir dest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue