From 63e21a607f5949b53b0aa6967a6d743fbe4bbf75 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 30 Sep 2016 13:17:49 -0400 Subject: [PATCH] remove unnecessary mvar --- Remote/External.hs | 4 ++-- Remote/External/Types.hs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Remote/External.hs b/Remote/External.hs index 13c46585b8..b10977b6d1 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -242,13 +242,13 @@ handleRequest' lck external req mp responsehandler send $ VALUE value handleRemoteRequest (SETCREDS setting login password) = do c <- liftIO $ atomically $ readTMVar $ externalConfig external - gc <- liftIO $ atomically $ readTMVar $ externalGitConfig external + let gc = externalGitConfig external c' <- setRemoteCredPair encryptionAlreadySetup c gc (credstorage setting) $ Just (login, password) void $ liftIO $ atomically $ swapTMVar (externalConfig external) c' handleRemoteRequest (GETCREDS setting) = do c <- liftIO $ atomically $ readTMVar $ externalConfig external - gc <- liftIO $ atomically $ readTMVar $ externalGitConfig external + let gc = externalGitConfig external creds <- fromMaybe ("", "") <$> getRemoteCredPair c gc (credstorage setting) send $ CREDS (fst creds) (snd creds) diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs index 87c2dc056c..be608d4e57 100644 --- a/Remote/External/Types.hs +++ b/Remote/External/Types.hs @@ -54,8 +54,7 @@ data External = External , externalLock :: TMVar ExternalLock -- Never left empty. , externalConfig :: TMVar RemoteConfig - -- Never left empty. - , externalGitConfig :: TMVar RemoteGitConfig + , externalGitConfig :: RemoteGitConfig } newExternal :: ExternalType -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex External @@ -65,7 +64,7 @@ newExternal externaltype u c gc = liftIO $ External <*> atomically newEmptyTMVar <*> atomically (newTMVar ExternalLock) <*> atomically (newTMVar c) - <*> atomically (newTMVar gc) + <*> pure gc type ExternalType = String