From d5f672ddd59b43cb9b1bac8f836864165c8931f2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 23 May 2016 17:03:20 -0400 Subject: 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. --- Remote/Helper/Special.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Remote/Helper/Special.hs') 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 -- cgit v1.2.3