summaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-04-27 20:30:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-04-27 20:31:56 -0400
commit39966ba4eeb6046c511d3f3b630a3ee2ced5019a (patch)
tree736288a558d829ba0c801c1082382b69507f8b17 /Remote/Rsync.hs
parente68f128a9bf46c8f4ebe51fcb3b6f63955cadd2e (diff)
filter out --delete rsync option
rsync does not have a --no-delete, so do it this way instead
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 0a62ff92f..21c570a87 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -48,9 +48,7 @@ remote = RemoteType {
gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex (Remote Annex)
gen r u c = do
- url <- getConfig r "rsyncurl" (error "missing rsyncurl")
- opts <- getConfig r "rsync-options" ""
- let o = RsyncOpts url $ map Param $ words opts
+ o <- genRsyncOpts r
cst <- remoteCost r expensiveRemoteCost
return $ encryptableRemote c
(storeEncrypted o)
@@ -67,6 +65,20 @@ gen r u c = do
config = Nothing
}
+genRsyncOpts :: Git.Repo -> Annex RsyncOpts
+genRsyncOpts r = do
+ url <- getConfig r "rsyncurl" (error "missing rsyncurl")
+ opts <- getConfig r "rsync-options" ""
+ return $ RsyncOpts url $ map Param $ filter safe $ words opts
+ where
+ safe o
+ -- Don't allow user to pass --delete to rsync;
+ -- that could cause it to delete other keys
+ -- in the same hash bucket as a key it sends.
+ | o == "--delete" = False
+ | o == "--delete-excluded" = False
+ | otherwise = True
+
rsyncSetup :: UUID -> RemoteConfig -> Annex RemoteConfig
rsyncSetup u c = do
-- verify configuration is sane