From 67cc72d540d8dd03f433a135297ba86d896ba14d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Dec 2012 12:44:24 -0400 Subject: normalise associated files Sometimes ./file will be passed in, and sometimes file; need to treat these the same. --- Annex/Content/Direct.hs | 8 +++++--- Annex/Direct.hs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'Annex') diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index 5e33a8951..64182ddc6 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -54,16 +54,18 @@ changeAssociatedFiles key transform = do removeAssociatedFile :: Key -> FilePath -> Annex [FilePath] removeAssociatedFile key file = do - fs <- changeAssociatedFiles key $ filter (/= file) + fs <- changeAssociatedFiles key $ filter (/= normalise file) when (null fs) $ logStatus key InfoMissing return fs addAssociatedFile :: Key -> FilePath -> Annex [FilePath] addAssociatedFile key file = changeAssociatedFiles key $ \files -> - if file `elem` files + if file' `elem` files then files - else file:files + else file':files + where + file' = normalise file {- Checks if a file in the tree, associated with a key, has not been modified. - diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 3846b0a9e..6ddea08fb 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -175,7 +175,7 @@ toDirectGen :: Key -> FilePath -> Annex (Maybe (Annex ())) toDirectGen k f = do loc <- inRepo $ gitAnnexLocation k createContentDir loc -- thaws directory too - locs <- filter (/= f) <$> addAssociatedFile k f + locs <- filter (/= normalise f) <$> addAssociatedFile k f case locs of [] -> ifM (liftIO $ doesFileExist loc) ( return $ Just $ do -- cgit v1.2.3