diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-05-10 13:03:56 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-05-10 13:03:56 -0400 |
commit | ae8a630b3cfac9ed3ea8c3137619e13ee021071e (patch) | |
tree | 4c28656ee3a81c09b99cfee48844069a7958908b /Remote | |
parent | ce8dcc753490e2a51cf86005944a5255520059cf (diff) |
Added annex.gnupg-decrypt-options and remote.<name>.annex-gnupg-decrypt-options, which are passed to gpg when it's decrypting data.
The naming is unofrtunately not consistent, but the gnupg-options
were only used for encrypting, and it's too late to change that.
It would be nice to have a third setting that is always passed to gnupg,
but ~/.gnupg/options can be used to specify such global options when really
needed.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Helper/Special.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs index f9b5deae4..cf0524dc4 100644 --- a/Remote/Helper/Special.hs +++ b/Remote/Helper/Special.hs @@ -178,7 +178,8 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp } cip = cipherKey c isencrypted = isJust (extractCipher c) - gpgopts = getGpgEncParams encr + gpgencopts = getGpgEncParams encr + gpgdecopts = getGpgDecParams encr safely a = catchNonAsync a (\e -> warning (show e) >> return False) @@ -200,7 +201,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 gpgopts cipher (feedBytes b) $ + encrypt cmd gpgencopts cipher (feedBytes b) $ readBytes $ \encb -> storer (enck k) (ByteContent encb) p @@ -210,7 +211,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) + enck k dest p' (sink dest enc gpgdecopts) go Nothing = return False enck = maybe id snd enc @@ -245,23 +246,24 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp sink :: FilePath -> Maybe (Cipher, EncKey) + -> [CommandParam] -> Maybe Handle -> Maybe MeterUpdate -> ContentSource -> Annex Bool -sink dest enc mh mp content = do +sink dest enc gpgdecopts 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 cipher (feedBytes b) $ + decrypt cmd gpgdecopts cipher (feedBytes b) $ readBytes write (Just (cipher, _), _, FileContent f) -> do cmd <- gpgCmd <$> Annex.getGitConfig withBytes content $ \b -> - decrypt cmd cipher (feedBytes b) $ + decrypt cmd gpgdecopts cipher (feedBytes b) $ readBytes write liftIO $ nukeFile f (Nothing, _, FileContent f) -> do |