summaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-15 13:38:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-15 13:38:05 -0400
commit6c36d87ceff8b792e1f1a0f6b324e79173cc923c (patch)
treecf686e3db00d4a571412bbadfc91231accac16bc /Annex/Direct.hs
parentcfaa1a8fcf522ef3f51bbd2a057e7ab571bcdd1b (diff)
direct: Avoid leaving file content in misctemp if interrupted.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 374599369..7b91cc342 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -353,11 +353,8 @@ toDirectGen k f = do
void $ addAssociatedFile k f
modifyContent loc $ do
thawContent loc
- replaceFileOr f
- (liftIO . moveFile loc)
- $ \tmp -> do -- rollback
- liftIO (moveFile tmp loc)
- freezeContent loc
+ liftIO (replaceFileFrom loc f)
+ `catchIO` (\_ -> freezeContent loc)
fromdirect loc = do
replaceFile f $
liftIO . void . copyFileExternal loc