diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-03-10 13:12:24 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-03-10 13:35:31 -0400 |
commit | 8cb9381befed4174624edfc80e09185c9340b4f6 (patch) | |
tree | e5d2041ff38502b1f8a5ef9caa6515cccfcea555 /Remote | |
parent | e230fd58b5f5d5d16f87e1bd5c0f2e553f2ae5a2 (diff) |
AssociatedFile newtype
To prevent any further mistakes like 1a497cefb47557f0b4788c606f9071be422b2511
This commit was sponsored by Francois Marier on Patreon.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/GCrypt.hs | 9 | ||||
-rw-r--r-- | Remote/Git.hs | 3 | ||||
-rw-r--r-- | Remote/Helper/Ssh.hs | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs index 79020f40c..ea101a770 100644 --- a/Remote/GCrypt.hs +++ b/Remote/GCrypt.hs @@ -326,7 +326,8 @@ store r rsyncopts return True | Git.repoIsSsh (repo r) = if accessShell r then fileStorer $ \k f p -> Ssh.rsyncHelper (Just p) - =<< Ssh.rsyncParamsRemote False r Upload k f Nothing + =<< Ssh.rsyncParamsRemote False r Upload k f + (AssociatedFile Nothing) else fileStorer $ Remote.Rsync.store rsyncopts | otherwise = unsupportedUrl @@ -336,8 +337,10 @@ retrieve r rsyncopts guardUsable (repo r) (return False) $ sink =<< liftIO (L.readFile $ gCryptLocation r k) | Git.repoIsSsh (repo r) = if accessShell r - then fileRetriever $ \f k p -> - unlessM (Ssh.rsyncHelper (Just p) =<< Ssh.rsyncParamsRemote False r Download k f Nothing) $ + then fileRetriever $ \f k p -> do + ps <- Ssh.rsyncParamsRemote False r Download k f + (AssociatedFile Nothing) + unlessM (Ssh.rsyncHelper (Just p) ps) $ giveup "rsync failed" else fileRetriever $ Remote.Rsync.retrieve rsyncopts | otherwise = unsupportedUrl diff --git a/Remote/Git.hs b/Remote/Git.hs index 9cb369e4d..e5d85d2c2 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -479,8 +479,9 @@ copyFromRemote' r key file dest meterupdate ) feedprogressback' a = do u <- getUUID + let AssociatedFile afile = file let fields = (Fields.remoteUUID, fromUUID u) - : maybe [] (\f -> [(Fields.associatedFile, f)]) file + : maybe [] (\f -> [(Fields.associatedFile, f)]) afile Just (cmd, params) <- Ssh.git_annex_shell ConsumeStdin (repo r) "transferinfo" [Param $ key2file key] fields diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index 7f64b4645..0bdc3535a 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -126,7 +126,7 @@ rsyncHelper m params = do {- Generates rsync parameters that ssh to the remote and asks it - to either receive or send the key's content. -} rsyncParamsRemote :: Bool -> Remote -> Direction -> Key -> FilePath -> AssociatedFile -> Annex [CommandParam] -rsyncParamsRemote unlocked r direction key file afile = do +rsyncParamsRemote unlocked r direction key file (AssociatedFile afile) = do u <- getUUID let fields = (Fields.remoteUUID, fromUUID u) : (Fields.unlocked, if unlocked then "1" else "") |