diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-07 14:51:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-07 15:14:15 -0400 |
commit | de92739546ba6fd82963e9932d622b891f8ff096 (patch) | |
tree | b60fc4d87f9ac341c3babf68fe020eeaacb52a18 /Annex | |
parent | 3729ee0549993ccb648b7f798c9c400661350cdf (diff) |
migrate and rekey v6 unlocked file support
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 9e8da49e9..fd0a2742c 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -30,6 +30,8 @@ module Annex.Content ( LinkAnnexResult(..), unlinkAnnex, checkedCopyFile, + linkOrCopy, + linkOrCopy', sendAnnex, prepSendAnnex, removeAnnex, @@ -582,11 +584,14 @@ linkAnnex fromto key src (Just srcic) dest = do {- Hard links or copies src to dest. Only uses a hard link when annex.thin - is enabled and when src is not already hardlinked to elsewhere. - - Checks disk reserve before copying, and will fail if not enough space, - - or if the dest file already exists. -} + - Checks disk reserve before copying against the size of the key, + - and will fail if not enough space, or if the dest file already exists. -} linkOrCopy :: Key -> FilePath -> FilePath -> Annex Bool -linkOrCopy key src dest = catchBoolIO $ - ifM (annexThin <$> Annex.getGitConfig) +linkOrCopy = linkOrCopy' (annexThin <$> Annex.getGitConfig) + +linkOrCopy' :: Annex Bool -> Key -> FilePath -> FilePath -> Annex Bool +linkOrCopy' canhardlink key src dest = catchBoolIO $ + ifM canhardlink ( hardlink , copy =<< getstat ) |