diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-19 16:07:36 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-19 16:07:36 -0400 |
commit | 06b0cb6224377fd2ea86e4e209e94a502f92716e (patch) | |
tree | ae6f1a631aebbdd18a2aef7ff7ec7299d9214d26 /Remote/Rsync.hs | |
parent | 94aa6b42b5bc5c37c7017fb3493010a56a9d211e (diff) |
add tmp flag parameter to retrieveKeyFile
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r-- | Remote/Rsync.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index eeb116675..b4ff3d6f1 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -104,9 +104,9 @@ storeEncrypted o (cipher, enck) k = withTmp enck $ \tmp -> do liftIO $ withEncryptedContent cipher (L.readFile src) $ L.writeFile tmp rsyncSend o enck tmp -retrieve :: RsyncOpts -> Key -> FilePath -> Annex Bool -retrieve o k f = untilTrue (rsyncUrls o k) $ \u -> do - unlessM (liftIO $ doesFileExist f) $ whenM (inAnnex k) $ preseed +retrieve :: RsyncOpts -> Key -> Bool -> FilePath -> Annex Bool +retrieve o k tmp f = untilTrue (rsyncUrls o k) $ \u -> do + when tmp $ preseed rsyncRemote o -- use inplace when retrieving to support resuming [ Param "--inplace" @@ -115,14 +115,15 @@ retrieve o k f = untilTrue (rsyncUrls o k) $ \u -> do ] where -- this speeds up fsck --from - preseed = do - s <- inRepo $ gitAnnexLocation k - liftIO $ whenM (copyFileExternal s f) $ - allowWrite f + preseed = unlessM (liftIO $ doesFileExist f) $ + whenM (inAnnex k) $ do + s <- inRepo $ gitAnnexLocation k + liftIO $ whenM (copyFileExternal s f) $ + allowWrite f retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> FilePath -> Annex Bool retrieveEncrypted o (cipher, enck) f = withTmp enck $ \tmp -> do - res <- retrieve o enck tmp + res <- retrieve o enck False tmp if res then liftIO $ catchBoolIO $ do withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f |