aboutsummaryrefslogtreecommitdiff
path: root/Creds.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-23 17:08:43 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-23 17:08:43 -0400
commit063d84ddd33f1aa0624cf5f363f2c58397b98562 (patch)
treec94f587d1338b5ab59bf44626c1d70915ec21134 /Creds.hs
parentd5f672ddd59b43cb9b1bac8f836864165c8931f2 (diff)
plumb RemoteGitConfig through to setRemoteCredPair
Diffstat (limited to 'Creds.hs')
-rw-r--r--Creds.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/Creds.hs b/Creds.hs
index a72c704e8..72e177abc 100644
--- a/Creds.hs
+++ b/Creds.hs
@@ -51,10 +51,10 @@ data CredPairStorage = CredPairStorage
- if that's going to be done, so that the creds can be encrypted using the
- cipher. The EncryptionIsSetup phantom type ensures that is the case.
-}
-setRemoteCredPair :: EncryptionIsSetup -> RemoteConfig -> CredPairStorage -> Maybe CredPair -> Annex RemoteConfig
-setRemoteCredPair encsetup c storage mcreds = case mcreds of
- Nothing -> maybe (return c) (setRemoteCredPair encsetup c storage . Just)
- =<< getRemoteCredPair c nogitconfig storage
+setRemoteCredPair :: EncryptionIsSetup -> RemoteConfig -> RemoteGitConfig -> CredPairStorage -> Maybe CredPair -> Annex RemoteConfig
+setRemoteCredPair encsetup c gc storage mcreds = case mcreds of
+ Nothing -> maybe (return c) (setRemoteCredPair encsetup c gc storage . Just)
+ =<< getRemoteCredPair c gc storage
Just creds
| embedCreds c -> case credPairRemoteKey storage of
Nothing -> localcache creds
@@ -67,16 +67,12 @@ setRemoteCredPair encsetup c storage mcreds = case mcreds of
storeconfig creds key (Just cipher) = do
cmd <- gpgCmd <$> Annex.getGitConfig
- s <- liftIO $ encrypt cmd (c, nogitconfig) cipher
+ s <- liftIO $ encrypt cmd (c, gc) cipher
(feedBytes $ L.pack $ encodeCredPair creds)
(readBytes $ return . L.unpack)
return $ M.insert key (toB64 s) c
storeconfig creds key Nothing =
return $ M.insert key (toB64 $ encodeCredPair creds) c
- -- This is used before a remote is set up typically, so
- -- use a default RemoteGitConfig
- nogitconfig :: RemoteGitConfig
- nogitconfig = def
{- Gets a remote's credpair, from the environment if set, otherwise
- from the cache in gitAnnexCredsDir, or failing that, from the