diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-17 16:39:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-17 16:39:30 -0400 |
commit | a020b0c25c4e7c2e14d685eac8c4d3aa0e1fef8a (patch) | |
tree | e008a967ab6ea350e97c723924fd8f95ad91d04c /Commands.hs | |
parent | 8398b9ab4a654f3f6ec570b70229a8a0030e8ab6 (diff) |
atomic file retrieval from backends
Diffstat (limited to 'Commands.hs')
-rw-r--r-- | Commands.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Commands.hs b/Commands.hs index 8591dbf6a..05af0ab2d 100644 --- a/Commands.hs +++ b/Commands.hs @@ -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 |