aboutsummaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-06-01 13:52:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-06-01 13:52:23 -0400
commit39c13f91004b41166b786785083e78b34df0c48f (patch)
treebf5ea0acf27c9075a63d3b23b970c3ea44ecee64 /Remote/Rsync.hs
parent3a9ca30fa8740a57ea477243498339f9738102d6 (diff)
remove Params constructor from Utility.SafeCommand
This removes a bit of complexity, and should make things faster (avoids tokenizing Params string), and probably involve less garbage collection. In a few places, it was useful to use Params to avoid needing a list, but that is easily avoided. Problems noticed while doing this conversion: * Some uses of Params "oneword" which was entirely unnecessary overhead. * A few places that built up a list of parameters with ++ and then used Params to split it! Test suite passes.
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 2c8b17884..3986863b3 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -172,10 +172,9 @@ store o k src meterupdate = withRsyncScratchDir $ \tmp -> do
ps <- sendParams
if ok
then showResumable $ rsyncRemote Upload o (Just meterupdate) $ ps ++
- [ Param "--recursive"
- , partialParams
+ Param "--recursive" : partialParams ++
-- tmp/ to send contents of tmp dir
- , File $ addTrailingPathSeparator tmp
+ [ File $ addTrailingPathSeparator tmp
, Param $ rsyncUrl o
]
else return False
@@ -204,9 +203,9 @@ remove o k = do
rsync $ rsyncOptions o ++ ps ++
map (\s -> Param $ "--include=" ++ s) includes ++
[ Param "--exclude=*" -- exclude everything else
- , Params "--quiet --delete --recursive"
- , partialParams
- , Param $ addTrailingPathSeparator dummy
+ , Param "--quiet", Param "--delete", Param "--recursive"
+ ] ++ partialParams ++
+ [ Param $ addTrailingPathSeparator dummy
, Param $ rsyncUrl o
]
where
@@ -237,8 +236,8 @@ checkKey r o k = do
{- Rsync params to enable resumes of sending files safely,
- ensure that files are only moved into place once complete
-}
-partialParams :: CommandParam
-partialParams = Params "--partial --partial-dir=.rsync-partial"
+partialParams :: [CommandParam]
+partialParams = [Param "--partial", Param "--partial-dir=.rsync-partial"]
{- When sending files from crippled filesystems, the permissions can be all
- messed up, and it's better to use the default permissions on the
@@ -290,7 +289,7 @@ rsyncRemote direction o m params = do
oh <- mkOutputHandler
liftIO $ rsyncProgress oh meter ps
where
- ps = opts ++ [Params "--progress"] ++ params
+ ps = opts ++ Param "--progress" : params
opts
| direction == Download = rsyncDownloadOptions o
| otherwise = rsyncUploadOptions o