Honor core.sharedrepository when receiving and adding files in direct mode.

This commit is contained in:
Joey Hess 2013-09-03 13:35:49 -04:00
parent f536438ccc
commit 67fda9e669
3 changed files with 23 additions and 0 deletions

View file

@ -279,6 +279,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
then do then do
updateInodeCache key src updateInodeCache key src
replaceFile f $ liftIO . moveFile src replaceFile f $ liftIO . moveFile src
chmodContent f
forM_ fs $ forM_ fs $
addContentWhenNotPresent key f addContentWhenNotPresent key f
else ifM (goodContent key f) else ifM (goodContent key f)
@ -500,6 +501,18 @@ freezeContent file = unlessM crippledFileSystem $
removeModes writeModes . removeModes writeModes .
addModes [ownerReadMode] 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 {- Allows writing to an annexed file that freezeContent was called on
- before. -} - before. -}
thawContent :: FilePath -> Annex () thawContent :: FilePath -> Annex ()

2
debian/changelog vendored
View file

@ -25,6 +25,8 @@ git-annex (4.20130827) unstable; urgency=low
* Debian: Run the builtin test suite as an autopkgtest. * Debian: Run the builtin test suite as an autopkgtest.
* Debian: Recommend ssh-askpass, which ssh will use when the assistant * Debian: Recommend ssh-askpass, which ssh will use when the assistant
is run w/o a tty. Closes: #719832 is run w/o a tty. Closes: #719832
* Honor core.sharedrepository when receiving and adding files in direct
mode.
-- Joey Hess <joeyh@debian.org> Tue, 27 Aug 2013 11:03:00 -0400 -- Joey Hess <joeyh@debian.org> Tue, 27 Aug 2013 11:03:00 -0400

View file

@ -15,3 +15,11 @@ files transit through a special remote, using modes to limit access to
individual files is not wise.) individual files is not wise.)
--[[Joey]] --[[Joey]]
> Revisiting this, git-annex already honors core.sharedrepository settings,
> so I just needed to set it to `world` to allow everyone to read.
>
> There was a code path in direct mode where that didn't work; fixed that.
>
> [[done]]
> --[[Joey]]