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
18
configure.hs
18
configure.hs
|
@ -1,5 +1,4 @@
|
|||
{- Checks system configuration and generates SysConfig.hs.
|
||||
-}
|
||||
{- Checks system configuration and generates SysConfig.hs. -}
|
||||
|
||||
import System.IO
|
||||
import System.Cmd
|
||||
|
@ -12,8 +11,9 @@ data Config = Config String Bool
|
|||
|
||||
tests :: [TestDesc]
|
||||
tests = [
|
||||
TestDesc "cp -a" "cp_a" cp_a
|
||||
, TestDesc "cp --reflink" "cp_reflink" cp_reflink
|
||||
TestDesc "cp -a" "cp_a" $ testCp "-a"
|
||||
, TestDesc "cp -p" "cp_p" $ testCp "-p"
|
||||
, TestDesc "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto"
|
||||
]
|
||||
|
||||
tmpDir :: String
|
||||
|
@ -25,11 +25,9 @@ testFile = tmpDir ++ "/testfile"
|
|||
quiet :: String -> String
|
||||
quiet s = s ++ " 2>/dev/null"
|
||||
|
||||
cp_a :: Test
|
||||
cp_a = testCmd $ quiet $ "cp -a " ++ testFile ++ " " ++ testFile ++ ".new"
|
||||
|
||||
cp_reflink :: Test
|
||||
cp_reflink = testCmd $ quiet $ "cp --reflink=auto " ++ testFile ++ " " ++ testFile ++ ".new"
|
||||
testCp :: String -> Test
|
||||
testCp option = testCmd $ quiet $ "cp " ++ option ++ " " ++ testFile ++
|
||||
" " ++ testFile ++ ".new"
|
||||
|
||||
testCmd :: String -> Test
|
||||
testCmd c = do
|
||||
|
@ -51,6 +49,7 @@ writeSysConfig config = do
|
|||
header = [
|
||||
"{- Automatically generated by configure. -}"
|
||||
, "module SysConfig where"
|
||||
, ""
|
||||
]
|
||||
footer = []
|
||||
vars [] = []
|
||||
|
@ -58,6 +57,7 @@ writeSysConfig config = do
|
|||
showvar (Config name val) = [
|
||||
name ++ " :: Bool"
|
||||
, name ++ " = " ++ show val
|
||||
, ""
|
||||
]
|
||||
|
||||
runTests :: [TestDesc] -> IO [Config]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue