diff options
author | Fraser Tweedale <frase@frase.id.au> | 2014-05-16 21:34:43 +1000 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-05-16 15:46:43 -0400 |
commit | 905eaa8cf73a52d92edcb62c17abb2ca9bed863e (patch) | |
tree | 17f00f9ae395502c992dcc4d989328f460057410 /Remote/Helper | |
parent | eefa96844ef813b5ef985ff2db361988047546db (diff) |
execute remote.<name>.annex-shell on remote, if set
It is useful to be able to specify an alternative git-annex-shell
program to execute on the remote, e.g., to run a version not on the
PATH. Use remote.<name>.annex-shell if specified, instead of the
default "git-annex-shell" i.e., first so-named executable on the
PATH.
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Ssh.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 6848f7212..745e9c025 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -26,10 +26,8 @@ import Config {- 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. -} -toRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam] -toRepo r sshcmd = do - g <- fromRepo id - let c = extractRemoteGitConfig g (Git.repoDescribe r) +toRepo :: Git.Repo -> RemoteGitConfig -> [CommandParam] -> Annex [CommandParam] +toRepo r c sshcmd = do let opts = map Param $ remoteAnnexSshOptions c let host = fromMaybe (error "bad ssh url") $ Git.Url.hostuser r params <- sshCachingOptions (host, Git.Url.port r) opts @@ -41,16 +39,19 @@ 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) u <- getRepoUUID r - sshparams <- toRepo r [Param $ sshcmd u ] + sshparams <- toRepo r c [Param $ sshcmd u c] return $ Just ("ssh", sshparams) | otherwise = return Nothing where dir = Git.repoPath r shellcmd = "git-annex-shell" shellopts = Param command : File dir : params - sshcmd u = unwords $ - shellcmd : map shellEscape (toCommand shellopts) ++ + sshcmd u c = unwords $ + fromMaybe shellcmd (remoteAnnexShell c) + : map shellEscape (toCommand shellopts) ++ uuidcheck u ++ map shellEscape (toCommand fieldopts) uuidcheck NoUUID = [] |