summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-03 13:35:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-03 13:35:49 -0400
commit066cca60fdc2b90436a3356f19664d059da8580e (patch)
tree8e9b81e2cbebb14e44c37490dd8ac06d1abb9b25 /Annex
parent5204ee7342bb0e5bc70d4a51bbc486f4e5e49a12 (diff)
Honor core.sharedrepository when receiving and adding files in direct mode.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 01ad6f96f..25ee4c7db 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -279,6 +279,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
then do
updateInodeCache key src
replaceFile f $ liftIO . moveFile src
+ chmodContent f
forM_ fs $
addContentWhenNotPresent key f
else ifM (goodContent key f)
@@ -500,6 +501,18 @@ freezeContent file = unlessM crippledFileSystem $
removeModes writeModes .
addModes [ownerReadMode]
+{- Adjusts read mode of annexed file per core.sharedRepository setting. -}
+chmodContent :: FilePath -> Annex ()
+chmodContent file = unlessM crippledFileSystem $
+ liftIO . go =<< fromRepo getSharedRepository
+ where
+ go GroupShared = modifyFileMode file $
+ addModes [ownerReadMode, groupReadMode]
+ go AllShared = modifyFileMode file $
+ addModes readModes
+ go _ = modifyFileMode file $
+ addModes [ownerReadMode]
+
{- Allows writing to an annexed file that freezeContent was called on
- before. -}
thawContent :: FilePath -> Annex ()