diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-12-04 13:39:14 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-12-04 13:39:14 -0400 |
commit | e364396efca11355befa2d0f3e6eb89304c3dac7 (patch) | |
tree | 4848c55b11141525ab98e2495200fa8555abec84 /Annex | |
parent | 13ae7961f9ff251ac4c0d92823ebb7cf6577ce33 (diff) |
basic clean filter working
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 289a4f1b3..74fae381b 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -24,6 +24,7 @@ module Annex.Content ( withTmp, checkDiskSpace, moveAnnex, + linkAnnex, sendAnnex, prepSendAnnex, removeAnnex, @@ -470,6 +471,23 @@ moveAnnex key src = withObjectLoc key storeobject storedirect alreadyhave = liftIO $ removeFile src +{- Hard links a file into .git/annex/objects/, falling back to a copy + - if necessary. + - + - Does not lock down the hard linked object, so that the user can modify + - the source file. So, adding an object to the annex this way can + - prevent losing the content if the source file is deleted, but does not + - guard against modifications. + -} +linkAnnex :: Key -> FilePath -> Annex Bool +linkAnnex key src = do + dest <- calcRepo (gitAnnexLocation key) + ifM (liftIO $ doesFileExist dest) + ( return True + , modifyContent dest $ + liftIO $ createLinkOrCopy src dest + ) + {- 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. |