summaryrefslogtreecommitdiff
path: root/Annex/Ssh.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/Ssh.hs')
-rw-r--r--Annex/Ssh.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 39983ab25..79cfbe908 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -37,15 +37,17 @@ sshParams (host, port) opts = go =<< sshInfo (host, port)
sshCleanup
sshInfo :: (String, Maybe Integer) -> Annex (Maybe FilePath, [CommandParam])
-sshInfo (host, port) = do
- caching <- fromMaybe SysConfig.sshconnectioncaching . Git.configTrue
- <$> fromRepo (Git.Config.get "annex.sshcaching" "")
- if caching
- then do
- dir <- fromRepo gitAnnexSshDir
- let socketfile = dir </> hostport2socket host port
- return (Just socketfile, cacheParams socketfile)
- else return (Nothing, [])
+sshInfo (host, port) = ifM caching
+ ( do
+ dir <- fromRepo gitAnnexSshDir
+ let socketfile = dir </> hostport2socket host port
+ return (Just socketfile, cacheParams socketfile)
+ , return (Nothing, [])
+ )
+ where
+ caching = fromMaybe SysConfig.sshconnectioncaching
+ . Git.configTrue
+ <$> fromRepo (Git.Config.get "annex.sshcaching" "")
cacheParams :: FilePath -> [CommandParam]
cacheParams socketfile =