From a5cb4a7bc5d7d603fc8f5f8b1a1595e889fb25ce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Jun 2013 13:10:30 -0400 Subject: 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. --- Command/ReKey.hs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'Command/ReKey.hs') 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 -- cgit v1.2.3