support gpg.program

When gpg.program is configured, it's used to get the command to run for
gpg. Useful on systems that have only a gpg2 command or want to use it
instead of the gpg command.
This commit is contained in:
Joey Hess 2015-09-09 18:06:49 -04:00
parent cf85370ade
commit 0390efae8c
17 changed files with 173 additions and 113 deletions

View file

@ -20,6 +20,7 @@ import Control.Exception
import Data.Default
import Common.Annex
import qualified Annex
import Types.Remote
import Types.GitConfig
import Types.Crypto
@ -300,7 +301,8 @@ setGcryptEncryption c remotename = do
Just (EncryptedCipher _ _ (KeyIds { keyIds = ks})) -> do
setConfig participants (unwords ks)
let signingkey = ConfigKey $ Git.GCrypt.remoteSigningKey remotename
skeys <- M.keys <$> liftIO secretKeys
cmd <- gpgCmd <$> Annex.getGitConfig
skeys <- M.keys <$> liftIO (secretKeys cmd)
case filter (`elem` ks) skeys of
[] -> noop
(k:_) -> setConfig signingkey k