Pass -a to cp even when it supports --reflink=auto, to preserve permissions.
Amoung other things, this makes unlocking a WORM backed file and then re-adding it without making any changes not add a new object, as the timestamp is preserved.
This commit is contained in:
parent
300d3cbdef
commit
e36808e167
2 changed files with 14 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex file copying
|
||||
-
|
||||
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
||||
- Copyright 2010,2012 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
@ -16,10 +16,10 @@ copyFileExternal :: FilePath -> FilePath -> IO Bool
|
|||
copyFileExternal src dest = do
|
||||
whenM (doesFileExist dest) $
|
||||
removeFile dest
|
||||
boolSystem "cp" [params, File src, File dest]
|
||||
boolSystem "cp" $ params ++ [File src, File dest]
|
||||
where
|
||||
params
|
||||
| SysConfig.cp_reflink_auto = Params "--reflink=auto"
|
||||
| SysConfig.cp_a = Params "-a"
|
||||
| SysConfig.cp_p = Params "-p"
|
||||
| otherwise = Params ""
|
||||
params = map snd $ filter fst
|
||||
[ (SysConfig.cp_reflink_auto, Param "--reflink=auto")
|
||||
, (SysConfig.cp_a, Param "-a")
|
||||
, (SysConfig.cp_p && not SysConfig.cp_a, Param "-p")
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue