summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-23 17:03:20 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-23 17:03:20 -0400
commitd5f672ddd59b43cb9b1bac8f836864165c8931f2 (patch)
tree6a020605b69d22252d2b9d619115326848a779c1 /Remote/Helper
parent7e637c86630b65621d301afb174cd95efe567130 (diff)
Pass the various gnupg-options configs to gpg in several cases where they were not before.
Removed the instance LensGpgEncParams RemoteConfig because it encouraged code that does not take the RemoteGitConfig into account. RemoteType's setup was changed to take a RemoteGitConfig, although the only place that is able to provide a non-empty one is enableremote, when it's changing an existing remote. This led to several folow-on changes, and got RemoteGitConfig plumbed through.
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Special.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs
index cf0524dc4..48cf09867 100644
--- a/Remote/Helper/Special.hs
+++ b/Remote/Helper/Special.hs
@@ -178,8 +178,6 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
}
cip = cipherKey c
isencrypted = isJust (extractCipher c)
- gpgencopts = getGpgEncParams encr
- gpgdecopts = getGpgDecParams encr
safely a = catchNonAsync a (\e -> warning (show e) >> return False)
@@ -201,7 +199,7 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
storechunk (Just (cipher, enck)) storer k content p = do
cmd <- gpgCmd <$> Annex.getGitConfig
withBytes content $ \b ->
- encrypt cmd gpgencopts cipher (feedBytes b) $
+ encrypt cmd encr cipher (feedBytes b) $
readBytes $ \encb ->
storer (enck k) (ByteContent encb) p
@@ -211,7 +209,7 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
where
go (Just retriever) = displayprogress p k $ \p' ->
retrieveChunks retriever (uuid baser) chunkconfig
- enck k dest p' (sink dest enc gpgdecopts)
+ enck k dest p' (sink dest enc encr)
go Nothing = return False
enck = maybe id snd enc
@@ -244,26 +242,27 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
- into place. (And it may even already be in the right place..)
-}
sink
- :: FilePath
+ :: LensGpgEncParams c
+ => FilePath
-> Maybe (Cipher, EncKey)
- -> [CommandParam]
+ -> c
-> Maybe Handle
-> Maybe MeterUpdate
-> ContentSource
-> Annex Bool
-sink dest enc gpgdecopts mh mp content = do
+sink dest enc c mh mp content = do
case (enc, mh, content) of
(Nothing, Nothing, FileContent f)
| f == dest -> noop
| otherwise -> liftIO $ moveFile f dest
(Just (cipher, _), _, ByteContent b) -> do
cmd <- gpgCmd <$> Annex.getGitConfig
- decrypt cmd gpgdecopts cipher (feedBytes b) $
+ decrypt cmd c cipher (feedBytes b) $
readBytes write
(Just (cipher, _), _, FileContent f) -> do
cmd <- gpgCmd <$> Annex.getGitConfig
withBytes content $ \b ->
- decrypt cmd gpgdecopts cipher (feedBytes b) $
+ decrypt cmd c cipher (feedBytes b) $
readBytes write
liftIO $ nukeFile f
(Nothing, _, FileContent f) -> do