summaryrefslogtreecommitdiff
path: root/Command/Unlock.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-18 13:48:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-18 13:49:01 -0400
commit161823d6eaff2adb7b99475b0edfe819fde11be1 (patch)
tree985788fced5af741d7da3b735876ba24e2b7f9d7 /Command/Unlock.hs
parent54513c69baffa40f2fcce42eb8651fdd98e05277 (diff)
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.
Diffstat (limited to 'Command/Unlock.hs')
-rw-r--r--Command/Unlock.hs7
1 files changed, 4 insertions, 3 deletions
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!"