summaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-01 13:52:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-01 13:58:14 -0400
commit18a3a186e9cdb69ee503d961d8285a341d818c48 (patch)
treed415a97f6c65e2268c948c6c2425d1b94b16df92 /Remote/Rsync.hs
parentb6e3e7516dfdc054b9e1a281b2e49b392d235ee2 (diff)
type based git config handling for remotes
Still a couple of places that use git config ad-hoc, but this is most of it done.
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs26
1 files changed, 11 insertions, 15 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 4c61d8e62..b05753830 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -38,10 +38,9 @@ remote = RemoteType {
setup = rsyncSetup
}
-gen :: Git.Repo -> UUID -> RemoteConfig -> Annex Remote
-gen r u c = do
- o <- genRsyncOpts r c
- cst <- remoteCost r expensiveRemoteCost
+gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex Remote
+gen r u c gc = do
+ cst <- remoteCost gc expensiveRemoteCost
return $ encryptableRemote c
(storeEncrypted o)
(retrieveEncrypted o)
@@ -58,27 +57,24 @@ gen r u c = do
, whereisKey = Nothing
, config = M.empty
, repo = r
+ , gitconfig = gc
, localpath = if rsyncUrlIsPath $ rsyncUrl o
then Just $ rsyncUrl o
else Nothing
, readonly = False
, remotetype = remote
}
-
-genRsyncOpts :: Git.Repo -> RemoteConfig -> Annex RsyncOpts
-genRsyncOpts r c = do
- url <- getRemoteConfig r "rsyncurl" (error "missing rsyncurl")
- opts <- map Param . filter safe . words
- <$> getRemoteConfig r "rsync-options" ""
- let escape = M.lookup "shellescape" c /= Just "no"
- return $ RsyncOpts url opts escape
where
- safe o
+ o = RsyncOpts url opts escape
+ url = fromMaybe (error "missing rsyncurl") $ remoteAnnexRsyncUrl gc
+ opts = map Param $ filter safe $ remoteAnnexRsyncOptions gc
+ escape = M.lookup "shellescape" c /= Just "no"
+ safe opt
-- 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
+ | opt == "--delete" = False
+ | opt == "--delete-excluded" = False
| otherwise = True
rsyncSetup :: UUID -> RemoteConfig -> Annex RemoteConfig