diff options
Diffstat (limited to 'Annex/Content/Direct.hs')
-rw-r--r-- | Annex/Content/Direct.hs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index 91073f687..ef2573c34 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -8,6 +8,7 @@ module Annex.Content.Direct ( associatedFiles, removeAssociatedFile, + removeAssociatedFileUnchecked, addAssociatedFile, goodContent, recordedInodeCache, @@ -73,15 +74,22 @@ changeAssociatedFiles key transform = do hPutStr h content hClose h -{- Removes an associated file. Returns new associatedFiles value. -} +{- Removes an associated file. Returns new associatedFiles value. + - Checks if this was the last copy of the object, and updates location + - log. -} removeAssociatedFile :: Key -> FilePath -> Annex [FilePath] removeAssociatedFile key file = do - file' <- normaliseAssociatedFile file - fs <- changeAssociatedFiles key $ filter (/= file') + fs <- removeAssociatedFileUnchecked key file when (null fs) $ logStatus key InfoMissing return fs +{- Removes an associated file. Returns new associatedFiles value. -} +removeAssociatedFileUnchecked :: Key -> FilePath -> Annex [FilePath] +removeAssociatedFileUnchecked key file = do + file' <- normaliseAssociatedFile file + changeAssociatedFiles key $ filter (/= file') + {- Adds an associated file. Returns new associatedFiles value. -} addAssociatedFile :: Key -> FilePath -> Annex [FilePath] addAssociatedFile key file = do |