summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-20 17:32:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-20 17:32:32 -0400
commiteb9001044f3db682236d1007aded58f47109d6a6 (patch)
treebacb884aa680a7126a66ed4826902f7eda79d01f
parent6ef82665de86195a7da6cffcba40874eba06424f (diff)
order user provided params after connection caching params
So the user can override them.
-rw-r--r--Annex/Ssh.hs15
-rw-r--r--Remote/Helper/Ssh.hs4
2 files changed, 9 insertions, 10 deletions
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 7f5ba48d8..c05e23604 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 88b29fdb6..c61d1b96f 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. -}