order user provided params after connection caching params
So the user can override them.
This commit is contained in:
parent
6ef82665de
commit
eb9001044f
2 changed files with 9 additions and 10 deletions
15
Annex/Ssh.hs
15
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 =
|
||||
|
|
|
@ -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. -}
|
||||
|
|
Loading…
Reference in a new issue