From 161823d6eaff2adb7b99475b0edfe819fde11be1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 18 Nov 2010 13:48:28 -0400 Subject: Only use cp -a if it is supported, falling back to cp -p or plain cp. * cp --reflink=auto is used if supported, and will make git annex unlock much faster on filesystems like btrfs that support copy of write. --- Command/Unlock.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Command/Unlock.hs') diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 3ff3023b2..34fde819c 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -8,7 +8,7 @@ module Command.Unlock where import Control.Monad.State (liftIO) -import System.Directory +import System.Directory hiding (copyFile) import Command import qualified Annex @@ -17,6 +17,7 @@ import Messages import Locations import Utility import Core +import CopyFile seek :: [SubCmdSeek] seek = [withFilesInGit start] @@ -34,9 +35,9 @@ perform dest key = do let src = annexLocation g key liftIO $ removeFile dest showNote "copying..." - ok <- liftIO $ boolSystem "cp" ["-p", src, dest] + ok <- liftIO $ copyFile src dest if ok then do liftIO $ allowWrite dest return $ Just $ return True - else error "cp failed!" + else error "copy failed!" -- cgit v1.2.3