aboutsummaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-04 14:20:32 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-04 14:20:32 -0400
commita9c942b0e0924786951e934335b864b708d3cc38 (patch)
tree1e569b0778151e79c5ae9b943ae7ba3731e37a3a /Annex/Content.hs
parentc44cfeb472284b06c4ed15578181a151b3571402 (diff)
clean filter should update location log when adding new content to annex
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 74fae381b..73cb6ab01 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -25,6 +25,7 @@ module Annex.Content (
checkDiskSpace,
moveAnnex,
linkAnnex,
+ LinkAnnexResult(..),
sendAnnex,
prepSendAnnex,
removeAnnex,
@@ -479,15 +480,20 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
- prevent losing the content if the source file is deleted, but does not
- guard against modifications.
-}
-linkAnnex :: Key -> FilePath -> Annex Bool
+linkAnnex :: Key -> FilePath -> Annex LinkAnnexResult
linkAnnex key src = do
dest <- calcRepo (gitAnnexLocation key)
ifM (liftIO $ doesFileExist dest)
- ( return True
+ ( return LinkAnnexNoop
, modifyContent dest $
- liftIO $ createLinkOrCopy src dest
+ ifM (liftIO $ createLinkOrCopy src dest)
+ ( return LinkAnnexOk
+ , return LinkAnnexFailed
+ )
)
+data LinkAnnexResult = LinkAnnexOk | LinkAnnexFailed | LinkAnnexNoop
+
{- Runs an action to transfer an object's content.
-
- In direct mode, it's possible for the file to change as it's being sent.