aboutsummaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-07 14:51:28 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-07 15:14:15 -0400
commitde92739546ba6fd82963e9932d622b891f8ff096 (patch)
treeb60fc4d87f9ac341c3babf68fe020eeaacb52a18 /Annex/Content.hs
parent3729ee0549993ccb648b7f798c9c400661350cdf (diff)
migrate and rekey v6 unlocked file support
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs13
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
)