ddar remote: fix ssh calls

sshOptions is now designed for working out ssh options only, and may
insert the extra options it is given to the middle. So it is incorrect
to call it with the remote parameters at the end. Instead, append them
to its return value.

This half regressed in 5be7ba7, and presumably regressed fully when
sshOptions was changed some time later.
This commit is contained in:
Robie Basak 2016-03-23 03:42:13 +00:00 committed by Joey Hess
parent 43713b1972
commit 7948110134
Failed to extract signature

View file

@ -122,8 +122,8 @@ ddarRemoteCall :: DdarRepo -> Char -> [CommandParam] -> Annex (String, [CommandP
ddarRemoteCall ddarrepo cmd params
| ddarLocal ddarrepo = return ("ddar", localParams)
| otherwise = do
os <- sshOptions (host, Nothing) (ddarRepoConfig ddarrepo) remoteParams
return ("ssh", os)
os <- sshOptions (host, Nothing) (ddarRepoConfig ddarrepo) []
return ("ssh", os ++ remoteParams)
where
(host, ddarrepo') = splitRemoteDdarRepo ddarrepo
localParams = Param [cmd] : Param (ddarRepoLocation ddarrepo) : params
@ -158,8 +158,8 @@ ddarDirectoryExists ddarrepo
Left _ -> Right False
Right status -> Right $ isDirectory status
| otherwise = do
ps <- sshOptions (host, Nothing) (ddarRepoConfig ddarrepo) params
exitCode <- liftIO $ safeSystem "ssh" ps
ps <- sshOptions (host, Nothing) (ddarRepoConfig ddarrepo) []
exitCode <- liftIO $ safeSystem "ssh" (ps ++ params)
case exitCode of
ExitSuccess -> return $ Right True
ExitFailure 1 -> return $ Right False