summaryrefslogtreecommitdiff
path: root/Command/Migrate.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-31 16:46:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-31 17:22:55 -0400
commit3d2a9f84051e9dc705ba4bb4828af691e479ae0e (patch)
treef99ff17d8fa860d1dcf2c8ebd8552e1e80bda8b3 /Command/Migrate.hs
parent00988bcf369671bdc3b78e95e3c2ae43f4835b1c (diff)
cleanup
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r--Command/Migrate.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs
index a68582996..2d4d24a22 100644
--- a/Command/Migrate.hs
+++ b/Command/Migrate.hs
@@ -56,11 +56,7 @@ perform file oldkey newbackend = do
case k of
Nothing -> stop
Just (newkey, _) -> do
- ok <- getViaTmpUnchecked newkey $ \t -> do
- -- Make a hard link to the old backend's
- -- cached key, to avoid wasting disk space.
- liftIO $ unlessM (doesFileExist t) $ createLink src t
- return True
+ ok <- link src newkey
if ok
then do
-- Update symlink to use the new key.
@@ -77,3 +73,8 @@ perform file oldkey newbackend = do
else stop
where
cleantmp t = 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.
+ liftIO $ unlessM (doesFileExist t) $ createLink src t
+ return True