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.
This commit is contained in:
parent
54513c69ba
commit
161823d6ea
7 changed files with 48 additions and 18 deletions
|
@ -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!"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue