added ifM and nuked 11 lines of code

no behavior changes
This commit is contained in:
Joey Hess 2012-03-14 17:43:34 -04:00
parent a4f72c9625
commit 60ab3d84e1
17 changed files with 151 additions and 162 deletions

View file

@ -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 =