optimise fsck --from normal git remotes
For a local git remote, can symlink the file. For a git remote using rsync, can preseed any local content. There are a few reasons to use fsck --from on a normal git remote. One is if it's using gitosis or similar, and you don't have shell access to run git annex locally. Another reason could be if you just want to fsck certian files of a bare remote.
This commit is contained in:
parent
f35a84fac7
commit
effaa298fa
3 changed files with 19 additions and 13 deletions
|
@ -19,8 +19,6 @@ import Remote.Helper.Special
|
|||
import Remote.Helper.Encryptable
|
||||
import Crypto
|
||||
import Utility.RsyncFile
|
||||
import Utility.CopyFile
|
||||
import Utility.FileMode
|
||||
|
||||
type RsyncUrl = String
|
||||
|
||||
|
@ -106,20 +104,13 @@ storeEncrypted o (cipher, enck) k = withTmp enck $ \tmp -> do
|
|||
|
||||
retrieve :: RsyncOpts -> Key -> Bool -> FilePath -> Annex Bool
|
||||
retrieve o k tmp f = untilTrue (rsyncUrls o k) $ \u -> do
|
||||
when tmp $ preseed
|
||||
when tmp $ preseedTmp k f
|
||||
rsyncRemote o
|
||||
-- use inplace when retrieving to support resuming
|
||||
[ Param "--inplace"
|
||||
, Param u
|
||||
, Param f
|
||||
]
|
||||
where
|
||||
-- this speeds up fsck --from
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue