diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-17 18:29:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-17 18:29:28 -0400 |
commit | c70b78d40a1f27176cc01c8ae02355b50d5cb607 (patch) | |
tree | 2187788256e655529cf098888038e8e917c03fda /Command/Migrate.hs | |
parent | 8b892901a98421b9b70c131bcc7af3a5e2ce62d9 (diff) |
migrate: Don't fall over a stale temp file.
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r-- | Command/Migrate.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs index 860c4bd47..045b8f9b1 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -48,9 +48,10 @@ perform file oldkey newbackend = do src <- fromRepo $ gitAnnexLocation oldkey tmp <- fromRepo gitAnnexTmpDir let tmpfile = tmp </> takeFileName file + cleantmp tmpfile liftIO $ createLink src tmpfile k <- Backend.genKey tmpfile $ Just newbackend - liftIO $ cleantmp tmpfile + cleantmp tmpfile case k of Nothing -> stop Just (newkey, _) -> do @@ -70,7 +71,7 @@ perform file oldkey newbackend = do next $ Command.Add.cleanup file newkey True else stop where - cleantmp t = whenM (doesFileExist t) $ removeFile t + cleantmp t = liftIO $ whenM (doesFileExist t) $ removeFile t link src newkey = getViaTmpUnchecked newkey $ \t -> do -- Make a hard link to the old backend's -- cached key, to avoid wasting disk space. |