diff options
author | Joey Hess <joey@kitenet.net> | 2013-06-10 13:10:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-06-10 13:11:33 -0400 |
commit | a5cb4a7bc5d7d603fc8f5f8b1a1595e889fb25ce (patch) | |
tree | 9b1e97311129413c5e0d33e9b52caa0ab66809dc /Command/ReKey.hs | |
parent | 7bf5b7b0c5ba2789ef1473329da0000af0410b61 (diff) |
Supports indirect mode on encfs in paranoia mode, and other filesystems that do not support hard links, but do support symlinks and other POSIX filesystem features.
Diffstat (limited to 'Command/ReKey.hs')
-rw-r--r-- | Command/ReKey.hs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Command/ReKey.hs b/Command/ReKey.hs index 05fd73f1b..d7b277fa6 100644 --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -7,8 +7,6 @@ module Command.ReKey where -import System.PosixCompat.Files - import Common.Annex import Command import qualified Annex @@ -17,7 +15,6 @@ import Annex.Content import qualified Command.Add import Logs.Web import Logs.Location -import Config import Utility.CopyFile def :: [Command] @@ -49,18 +46,14 @@ perform file oldkey newkey = do return True next $ cleanup file oldkey newkey -{- Make a hard link to the old key content, to avoid wasting disk space. -} +{- Make a hard link to the old key content (when supported), + - to avoid wasting disk space. -} linkKey :: Key -> Key -> Annex Bool linkKey oldkey newkey = getViaTmpUnchecked newkey $ \tmp -> do src <- calcRepo $ gitAnnexLocation oldkey - ifM (liftIO $ doesFileExist tmp) + liftIO $ ifM (doesFileExist tmp) ( return True - , ifM crippledFileSystem - ( liftIO $ copyFileExternal src tmp - , do - liftIO $ createLink src tmp - return True - ) + , createLinkOrCopy src tmp ) cleanup :: FilePath -> Key -> Key -> CommandCleanup |