atomic file retrieval from backends
This commit is contained in:
parent
8398b9ab4a
commit
a020b0c25c
4 changed files with 22 additions and 10 deletions
|
@ -156,13 +156,16 @@ getCmd file = notinBackend file err $ \(key, backend) -> do
|
|||
showStart "get" file
|
||||
g <- Annex.gitRepo
|
||||
let dest = annexLocation g key
|
||||
liftIO $ createDirectoryIfMissing True (parentDir dest)
|
||||
success <- Backend.retrieveKeyFile backend key dest
|
||||
let tmp = (annexTmpLocation g) ++ (keyFile key)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmp)
|
||||
success <- Backend.retrieveKeyFile backend key tmp
|
||||
if (success)
|
||||
then do
|
||||
liftIO $ renameFile tmp dest
|
||||
logStatus key ValuePresent
|
||||
showEndOk
|
||||
else showEndFail "get" file
|
||||
else do
|
||||
showEndFail "get" file
|
||||
where
|
||||
err = error $ "not annexed " ++ file
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue