diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Unlock.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 161df2ddf..ca8b62502 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -44,11 +44,15 @@ perform dest key = do g <- Annex.gitRepo let src = gitAnnexLocation g key - liftIO $ removeFile dest + let tmpdest = gitAnnexTmpLocation g key + liftIO $ createDirectoryIfMissing True (parentDir tmpdest) showNote "copying..." - ok <- liftIO $ copyFile src dest + ok <- liftIO $ copyFile src tmpdest if ok then do - liftIO $ allowWrite dest + liftIO $ do + removeFile dest + renameFile tmpdest dest + allowWrite dest next $ return True else error "copy failed!" |