From 45232c73510114017bb462c149f2f640be59a271 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 15 Feb 2013 13:51:50 -0400 Subject: migrate, rekey: copy rather than hard linking in crippled filesystem mode --- Command/ReKey.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Command/ReKey.hs') diff --git a/Command/ReKey.hs b/Command/ReKey.hs index df878a581..54a345dcb 100644 --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -14,6 +14,8 @@ import Types.Key import Annex.Content import qualified Command.Add import Logs.Web +import Config +import Utility.CopyFile def :: [Command] def = [notDirect $ command "rekey" @@ -48,8 +50,15 @@ perform file oldkey newkey = do linkKey :: Key -> Key -> Annex Bool linkKey oldkey newkey = getViaTmpUnchecked newkey $ \tmp -> do src <- inRepo $ gitAnnexLocation oldkey - liftIO $ unlessM (doesFileExist tmp) $ createLink src tmp - return True + ifM (liftIO $ doesFileExist tmp) + ( return True + , ifM crippledFileSystem + ( liftIO $ copyFileExternal src tmp + , do + liftIO $ createLink src tmp + return True + ) + ) cleanup :: FilePath -> Key -> Key -> CommandCleanup cleanup file oldkey newkey = do -- cgit v1.2.3