diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-20 15:34:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-20 17:14:56 -0400 |
commit | 47250a153a6c5a2864fec15fb136290683aeb1c6 (patch) | |
tree | 5c17ef6c035d6c919403e52e61ed0d37c2bfd824 /Remote | |
parent | 25f998679cd68cd4bb9b320998253f1b2ae23315 (diff) |
ssh connection caching
Ssh connection caching is now enabled automatically by git-annex. Only one
ssh connection is made to each host per git-annex run, which can speed some
things up a lot, as well as avoiding repeated password prompts. Concurrent
git-annex processes also share ssh connections. Cached ssh connections are
shut down when git-annex exits.
Note: The rsync special remote does not yet participate in the ssh
connection caching.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Helper/Ssh.hs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 7c5eeddb8..88b29fdb6 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -7,25 +7,21 @@ module Remote.Helper.Ssh where -import Common +import Common.Annex import qualified Git import qualified Git.Url -import Types import Config import Annex.UUID +import Annex.Ssh {- Generates parameters to ssh to a repository's host and run a command. - Caller is responsible for doing any neccessary shellEscaping of the - passed command. -} sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam] sshToRepo repo sshcmd = do - s <- getConfig repo "ssh-options" "" - let sshoptions = map Param (words s) - let sshport = case Git.Url.port repo of - Nothing -> [] - Just p -> [Param "-p", Param (show p)] - let sshhost = Param $ Git.Url.hostuser repo - return $ sshoptions ++ sshport ++ [sshhost] ++ sshcmd + opts <- map Param . words <$> getConfig repo "ssh-options" "" + params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) + return $ opts ++ params ++ sshcmd {- Generates parameters to run a git-annex-shell command on a remote - repository. -} |