diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-12 13:11:59 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-12 13:11:59 -0400 |
commit | 64176b55f99208a3769494eedb71bdd0bb57dde7 (patch) | |
tree | 9f69033ea2327d84122a118c0606748d994f4b2b /Annex/Content | |
parent | 27d9a1b8761c6d4fa4e88381bac3c3878aae5551 (diff) |
fix associated files to not fall back to object location
Diffstat (limited to 'Annex/Content')
-rw-r--r-- | Annex/Content/Direct.hs | 26 |
1 files changed, 10 insertions, 16 deletions
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' |