summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-03 20:24:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-03 20:25:44 -0400
commitea2e5e8a0e1a725bea0052cb583c23f38c68b984 (patch)
tree8a6379c4f236f0e3edbe52384b48c86a20792672
parent1b54fbff16a523f1b68248be37623c8d20b2fc7e (diff)
remove write bit when storing to local gcrypt repo
Same as is done by rsync, and for regular git repos.
-rw-r--r--Remote/GCrypt.hs11
1 files changed, 8 insertions, 3 deletions
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)