aboutsummaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-18 12:53:48 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-18 12:53:48 -0400
commit1326bb863516b5e7efbfd9fba2754a3fe7289315 (patch)
treeadb7e8106f1420c1ccee7eae30beb2667e060f81 /Remote/Rsync.hs
parented55a750d5255ac07bcd04adf4365a3255b3f605 (diff)
Avoid excessive escaping for rsync special remotes that are not accessed over ssh.
This is actually tricky, 45bbf210a1210172c7c7b87879ed74f7c8ccbdba added the escaping because it's needed for rsync that does go over ssh. So I had to detect whether the remote's rsync url will use ssh or not, and vary the escaping.
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 86ff2ea5b..5cd27a609 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -81,13 +81,18 @@ rsyncSetup u c = do
gitConfigSpecialRemote u c' "rsyncurl" url
return c'
+rsyncEscape :: RsyncOpts -> String -> String
+rsyncEscape o s
+ | rsyncUrlIsShell (rsyncUrl o) = shellEscape s
+ | otherwise = s
+
rsyncKey :: RsyncOpts -> Key -> String
-rsyncKey o k = rsyncUrl o </> hashDirMixed k </> shellEscape (f </> f)
+rsyncKey o k = rsyncUrl o </> hashDirMixed k </> rsyncEscape o (f </> f)
where
f = keyFile k
rsyncKeyDir :: RsyncOpts -> Key -> String
-rsyncKeyDir o k = rsyncUrl o </> hashDirMixed k </> shellEscape (keyFile k)
+rsyncKeyDir o k = rsyncUrl o </> hashDirMixed k </> rsyncEscape o (keyFile k)
store :: RsyncOpts -> Key -> Annex Bool
store o k = rsyncSend o k =<< fromRepo (gitAnnexLocation k)