From eb9001044f3db682236d1007aded58f47109d6a6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 20 Jan 2012 17:32:32 -0400 Subject: [PATCH] order user provided params after connection caching params So the user can override them. --- Annex/Ssh.hs | 15 +++++++-------- Remote/Helper/Ssh.hs | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs index 7f5ba48d84..c05e236040 100644 --- a/Annex/Ssh.hs +++ b/Annex/Ssh.hs @@ -20,15 +20,16 @@ import qualified Git.Config {- Generates parameters to ssh to a given host (or user@host) on a given - port, with connection caching. -} -sshParams :: (String, Maybe Integer) -> Annex [CommandParam] -sshParams (host, port) = go =<< sshInfo (host, port) +sshParams :: (String, Maybe Integer) -> [CommandParam] -> Annex [CommandParam] +sshParams (host, port) opts = go =<< sshInfo (host, port) where - go (Nothing, params) = return params + go (Nothing, params) = ret params go (Just socketfile, params) = do cleanstale liftIO $ createDirectoryIfMissing True $ parentDir socketfile lockFile $ socket2lock socketfile - return params + ret params + ret ps = return $ ps ++ opts ++ portParams port ++ [Param host] -- If the lock pool is empty, this is the first ssh of this -- run. There could be stale ssh connections hanging around -- from a previous git-annex run that was interrupted. @@ -42,10 +43,8 @@ sshInfo (host, port) = do then do dir <- fromRepo $ gitAnnexSshDir let socketfile = dir hostport2socket host port - return $ (Just socketfile, cacheParams socketfile ++ params) - else return (Nothing, params) - where - params = portParams port ++ [Param host] + return $ (Just socketfile, cacheParams socketfile) + else return (Nothing, []) cacheParams :: FilePath -> [CommandParam] cacheParams socketfile = diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 88b29fdb69..c61d1b96f2 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -20,8 +20,8 @@ import Annex.Ssh sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam] sshToRepo repo sshcmd = do opts <- map Param . words <$> getConfig repo "ssh-options" "" - params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) - return $ opts ++ params ++ sshcmd + params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) opts + return $ params ++ sshcmd {- Generates parameters to run a git-annex-shell command on a remote - repository. -}