From 64176b55f99208a3769494eedb71bdd0bb57dde7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 Dec 2012 13:11:59 -0400 Subject: fix associated files to not fall back to object location --- Annex/Content/Direct.hs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'Annex/Content') diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index 265195b87..f481030ba 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -27,23 +27,17 @@ import Utility.FileMode import System.Posix.Types import qualified Data.ByteString.Lazy as L -{- Files in the tree that are associated with a key. - - - - When no known associated files exist, returns the gitAnnexLocation. -} +{- Files in the tree that are associated with a key. -} associatedFiles :: Key -> Annex [FilePath] associatedFiles key = do - files <- associatedFilesList key - if null files - then do - l <- inRepo $ gitAnnexLocation key - return [l] - else do - top <- fromRepo Git.repoPath - return $ map (top ) files - -{- Raw list of files in the tree that are associated with a key. -} -associatedFilesList :: Key -> Annex [FilePath] -associatedFilesList key = do + files <- associatedFilesRelative key + top <- fromRepo Git.repoPath + return $ map (top ) files + +{- List of files in the tree that are associated with a key, relative to + - the top of the repo. -} +associatedFilesRelative :: Key -> Annex [FilePath] +associatedFilesRelative key = do mapping <- inRepo $ gitAnnexMapping key liftIO $ catchDefaultIO [] $ lines <$> readFile mapping @@ -52,7 +46,7 @@ associatedFilesList key = do changeAssociatedFiles :: Key -> ([FilePath] -> [FilePath]) -> Annex () changeAssociatedFiles key transform = do mapping <- inRepo $ gitAnnexMapping key - files <- associatedFilesList key + files <- associatedFilesRelative key let files' = transform files when (files /= files') $ liftIO $ viaTmp writeFile mapping $ unlines files' -- cgit v1.2.3