fix associated files to not fall back to object location
This commit is contained in:
parent
676c78436d
commit
f2ed0f9659
1 changed files with 9 additions and 15 deletions
|
@ -27,23 +27,17 @@ import Utility.FileMode
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
|
|
||||||
{- Files in the tree that are associated with a key.
|
{- Files in the tree that are associated with a key. -}
|
||||||
-
|
|
||||||
- When no known associated files exist, returns the gitAnnexLocation. -}
|
|
||||||
associatedFiles :: Key -> Annex [FilePath]
|
associatedFiles :: Key -> Annex [FilePath]
|
||||||
associatedFiles key = do
|
associatedFiles key = do
|
||||||
files <- associatedFilesList key
|
files <- associatedFilesRelative key
|
||||||
if null files
|
top <- fromRepo Git.repoPath
|
||||||
then do
|
return $ map (top </>) files
|
||||||
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. -}
|
{- List of files in the tree that are associated with a key, relative to
|
||||||
associatedFilesList :: Key -> Annex [FilePath]
|
- the top of the repo. -}
|
||||||
associatedFilesList key = do
|
associatedFilesRelative :: Key -> Annex [FilePath]
|
||||||
|
associatedFilesRelative key = do
|
||||||
mapping <- inRepo $ gitAnnexMapping key
|
mapping <- inRepo $ gitAnnexMapping key
|
||||||
liftIO $ catchDefaultIO [] $ lines <$> readFile mapping
|
liftIO $ catchDefaultIO [] $ lines <$> readFile mapping
|
||||||
|
|
||||||
|
@ -52,7 +46,7 @@ associatedFilesList key = do
|
||||||
changeAssociatedFiles :: Key -> ([FilePath] -> [FilePath]) -> Annex ()
|
changeAssociatedFiles :: Key -> ([FilePath] -> [FilePath]) -> Annex ()
|
||||||
changeAssociatedFiles key transform = do
|
changeAssociatedFiles key transform = do
|
||||||
mapping <- inRepo $ gitAnnexMapping key
|
mapping <- inRepo $ gitAnnexMapping key
|
||||||
files <- associatedFilesList key
|
files <- associatedFilesRelative key
|
||||||
let files' = transform files
|
let files' = transform files
|
||||||
when (files /= files') $
|
when (files /= files') $
|
||||||
liftIO $ viaTmp writeFile mapping $ unlines files'
|
liftIO $ viaTmp writeFile mapping $ unlines files'
|
||||||
|
|
Loading…
Add table
Reference in a new issue