diff options
author | Joey Hess <joey@kitenet.net> | 2014-05-16 16:08:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-05-16 16:08:20 -0400 |
commit | f4b3a2aee0052962f3f82c03f137c62f17d64e18 (patch) | |
tree | 00ec330f89eebb9ded13689a82e7c2ab1d31c36a /Remote/Helper | |
parent | ce4a677871eb33b5989005f6af209d6384d5f8a8 (diff) |
factor out getRemoteGitConfig
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Ssh.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 745e9c025..05a98865f 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -8,13 +8,13 @@ module Remote.Helper.Ssh where import Common.Annex +import qualified Annex import qualified Git import qualified Git.Url import Annex.UUID import Annex.Ssh import CmdLine.GitAnnexShell.Fields (Field, fieldName) import qualified CmdLine.GitAnnexShell.Fields as Fields -import Types.GitConfig import Types.Key import Remote.Helper.Messages import Utility.Metered @@ -27,8 +27,8 @@ import Config - Caller is responsible for doing any neccessary shellEscaping of the - passed command. -} toRepo :: Git.Repo -> RemoteGitConfig -> [CommandParam] -> Annex [CommandParam] -toRepo r c sshcmd = do - let opts = map Param $ remoteAnnexSshOptions c +toRepo r gc sshcmd = do + let opts = map Param $ remoteAnnexSshOptions gc let host = fromMaybe (error "bad ssh url") $ Git.Url.hostuser r params <- sshCachingOptions (host, Git.Url.port r) opts return $ params ++ Param host : sshcmd @@ -39,18 +39,17 @@ git_annex_shell :: Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> git_annex_shell r command params fields | not $ Git.repoIsUrl r = return $ Just (shellcmd, shellopts ++ fieldopts) | Git.repoIsSsh r = do - g <- fromRepo id - let c = extractRemoteGitConfig g (Git.repoDescribe r) + gc <- Annex.getRemoteGitConfig r u <- getRepoUUID r - sshparams <- toRepo r c [Param $ sshcmd u c] + sshparams <- toRepo r gc [Param $ sshcmd u gc] return $ Just ("ssh", sshparams) | otherwise = return Nothing where dir = Git.repoPath r shellcmd = "git-annex-shell" shellopts = Param command : File dir : params - sshcmd u c = unwords $ - fromMaybe shellcmd (remoteAnnexShell c) + sshcmd u gc = unwords $ + fromMaybe shellcmd (remoteAnnexShell gc) : map shellEscape (toCommand shellopts) ++ uuidcheck u ++ map shellEscape (toCommand fieldopts) |