summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-15 13:51:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-15 13:51:50 -0400
commit45232c73510114017bb462c149f2f640be59a271 (patch)
treef444e53d7b1b17d029328ac673c044284c35878b /Command
parent394c60f94e1bc198e9c1f8dd984ed6bb6ea82606 (diff)
migrate, rekey: copy rather than hard linking in crippled filesystem mode
Diffstat (limited to 'Command')
-rw-r--r--Command/ReKey.hs13
1 files changed, 11 insertions, 2 deletions
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