From ea2e5e8a0e1a725bea0052cb583c23f38c68b984 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 3 Aug 2014 20:24:13 -0400 Subject: remove write bit when storing to local gcrypt repo Same as is done by rsync, and for regular git repos. --- Remote/GCrypt.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Remote') diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs index db0144363..28fe9964b 100644 --- a/Remote/GCrypt.hs +++ b/Remote/GCrypt.hs @@ -300,9 +300,14 @@ store :: Remote -> Remote.Rsync.RsyncOpts -> Storer store r rsyncopts | not $ Git.repoIsUrl (repo r) = byteStorer $ \k b p -> guardUsable (repo r) False $ liftIO $ do - let dest = gCryptLocation r k - createDirectoryIfMissing True $ parentDir dest - meteredWriteFile p dest b + let f = gCryptLocation r k + let d = parentDir f + createDirectoryIfMissing True d + allowWrite d + void $ liftIO $ tryIO $ allowWrite f + meteredWriteFile p f b + preventWrite f + preventWrite d return True | Git.repoIsSsh (repo r) = if isShell r then fileStorer $ \k f p -> Ssh.rsyncHelper (Just p) -- cgit v1.2.3