From de92739546ba6fd82963e9932d622b891f8ff096 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 7 Jan 2016 14:51:28 -0400 Subject: migrate and rekey v6 unlocked file support --- Annex/Content.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Annex/Content.hs') 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 ) -- cgit v1.2.3