summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-06 19:11:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-06 19:24:11 -0400
commit5414bbce58041aa92f2a50a8e721507879000f77 (patch)
tree7e9bb34e6be4a52d266da351c747a6dd71c33d06 /Utility
parentf011033869bbeeb7941c1c6e16a2a138b11c92e4 (diff)
git-annex-shell uuid verification
* git-annex now asks git-annex-shell to verify that it's operating in the expected repository. * Note that this git-annex will not interoperate with remotes using older versions of git-annex-shell. The reason for this check is to avoid git-annex getting confused about what remote repository actually contains a value. It's a prerequisite for supporting git insteadOf aliases.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Ssh.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Utility/Ssh.hs b/Utility/Ssh.hs
index 05269552c..4d17a47ba 100644
--- a/Utility/Ssh.hs
+++ b/Utility/Ssh.hs
@@ -13,6 +13,7 @@ import qualified Git
import Utility.SafeCommand
import Types
import Config
+import UUID
{- Generates parameters to ssh to a repository's host and run a command.
- Caller is responsible for doing any neccessary shellEscaping of the
@@ -33,15 +34,20 @@ git_annex_shell :: Git.Repo -> String -> [CommandParam] -> Annex (Maybe (FilePat
git_annex_shell r command params
| not $ Git.repoIsUrl r = return $ Just (shellcmd, shellopts)
| Git.repoIsSsh r = do
- sshparams <- sshToRepo r [Param sshcmd]
+ uuid <- getUUID r
+ sshparams <- sshToRepo r [Param $ sshcmd uuid ]
return $ Just ("ssh", sshparams)
| otherwise = return Nothing
where
dir = Git.workTree r
shellcmd = "git-annex-shell"
shellopts = Param command : File dir : params
- sshcmd = shellcmd ++ " " ++
- unwords (map shellEscape $ toCommand shellopts)
+ sshcmd uuid = unwords $
+ shellcmd : (map shellEscape $ toCommand shellopts) ++
+ uuidcheck uuid
+ uuidcheck uuid
+ | null uuid = []
+ | otherwise = ["--uuid", uuid]
{- Uses a supplied function (such as boolSystem) to run a git-annex-shell
- command on a remote.