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
|
{- Generates parameters to ssh to a given host (or user@host) on a given
|
||||||
- port, with connection caching. -}
|
- port, with connection caching. -}
|
||||||
sshParams :: (String, Maybe Integer) -> Annex [CommandParam]
|
sshParams :: (String, Maybe Integer) -> [CommandParam] -> Annex [CommandParam]
|
||||||
sshParams (host, port) = go =<< sshInfo (host, port)
|
sshParams (host, port) opts = go =<< sshInfo (host, port)
|
||||||
where
|
where
|
||||||
go (Nothing, params) = return params
|
go (Nothing, params) = ret params
|
||||||
go (Just socketfile, params) = do
|
go (Just socketfile, params) = do
|
||||||
cleanstale
|
cleanstale
|
||||||
liftIO $ createDirectoryIfMissing True $ parentDir socketfile
|
liftIO $ createDirectoryIfMissing True $ parentDir socketfile
|
||||||
lockFile $ socket2lock 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
|
-- If the lock pool is empty, this is the first ssh of this
|
||||||
-- run. There could be stale ssh connections hanging around
|
-- run. There could be stale ssh connections hanging around
|
||||||
-- from a previous git-annex run that was interrupted.
|
-- from a previous git-annex run that was interrupted.
|
||||||
|
@ -42,10 +43,8 @@ sshInfo (host, port) = do
|
||||||
then do
|
then do
|
||||||
dir <- fromRepo $ gitAnnexSshDir
|
dir <- fromRepo $ gitAnnexSshDir
|
||||||
let socketfile = dir </> hostport2socket host port
|
let socketfile = dir </> hostport2socket host port
|
||||||
return $ (Just socketfile, cacheParams socketfile ++ params)
|
return $ (Just socketfile, cacheParams socketfile)
|
||||||
else return (Nothing, params)
|
else return (Nothing, [])
|
||||||
where
|
|
||||||
params = portParams port ++ [Param host]
|
|
||||||
|
|
||||||
cacheParams :: FilePath -> [CommandParam]
|
cacheParams :: FilePath -> [CommandParam]
|
||||||
cacheParams socketfile =
|
cacheParams socketfile =
|
||||||
|
|
|
@ -20,8 +20,8 @@ import Annex.Ssh
|
||||||
sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam]
|
sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam]
|
||||||
sshToRepo repo sshcmd = do
|
sshToRepo repo sshcmd = do
|
||||||
opts <- map Param . words <$> getConfig repo "ssh-options" ""
|
opts <- map Param . words <$> getConfig repo "ssh-options" ""
|
||||||
params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo)
|
params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) opts
|
||||||
return $ opts ++ params ++ sshcmd
|
return $ params ++ sshcmd
|
||||||
|
|
||||||
{- Generates parameters to run a git-annex-shell command on a remote
|
{- Generates parameters to run a git-annex-shell command on a remote
|
||||||
- repository. -}
|
- repository. -}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue