aboutsummaryrefslogtreecommitdiff
path: root/Remote/Helper/Ssh.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-08-13 15:05:39 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-08-13 15:05:39 -0400
commit7ac44206f2acda5721c88e4f5dd1f09384f9f05e (patch)
treea87a3db319acc7e210693b9224ff482438b5b323 /Remote/Helper/Ssh.hs
parent4a24dd0e9b1e8edc5db37adf7f305c8369e01d32 (diff)
--debug is passed along to git-annex-shell when git-annex is in debug mode.
Diffstat (limited to 'Remote/Helper/Ssh.hs')
-rw-r--r--Remote/Helper/Ssh.hs24
1 files changed, 16 insertions, 8 deletions
diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs
index 1e4daa1ad..162c34f4e 100644
--- a/Remote/Helper/Ssh.hs
+++ b/Remote/Helper/Ssh.hs
@@ -38,22 +38,30 @@ toRepo r gc sshcmd = do
- repository. -}
git_annex_shell :: Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> Annex (Maybe (FilePath, [CommandParam]))
git_annex_shell r command params fields
- | not $ Git.repoIsUrl r = return $ Just (shellcmd, shellopts ++ fieldopts)
+ | not $ Git.repoIsUrl r = do
+ shellopts <- getshellopts
+ return $ Just (shellcmd, shellopts ++ fieldopts)
| Git.repoIsSsh r = do
gc <- Annex.getRemoteGitConfig r
u <- getRepoUUID r
- sshparams <- toRepo r gc [Param $ sshcmd u gc]
+ shellopts <- getshellopts
+ let sshcmd = unwords $
+ fromMaybe shellcmd (remoteAnnexShell gc)
+ : map shellEscape (toCommand shellopts) ++
+ uuidcheck u ++
+ map shellEscape (toCommand fieldopts)
+ sshparams <- toRepo r gc [Param sshcmd]
return $ Just ("ssh", sshparams)
| otherwise = return Nothing
where
dir = Git.repoPath r
shellcmd = "git-annex-shell"
- shellopts = Param command : File dir : params
- sshcmd u gc = unwords $
- fromMaybe shellcmd (remoteAnnexShell gc)
- : map shellEscape (toCommand shellopts) ++
- uuidcheck u ++
- map shellEscape (toCommand fieldopts)
+ getshellopts = do
+ debug <- liftIO debugEnabled
+ let params' = if debug
+ then Param "--debug" : params
+ else params
+ return (Param command : File dir : params')
uuidcheck NoUUID = []
uuidcheck (UUID u) = ["--uuid", u]
fieldopts