From a2c056df650c6418f9deb168c07dbe3a8704f813 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Jan 2016 13:22:38 -0400 Subject: [PATCH] convert isPointerFile from Annex to IO --- Annex/AutoMerge.hs | 2 +- Annex/Content.hs | 2 +- Annex/Link.hs | 4 ++-- Command/Lock.hs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Annex/AutoMerge.hs b/Annex/AutoMerge.hs index a332596f68..462e87e093 100644 --- a/Annex/AutoMerge.hs +++ b/Annex/AutoMerge.hs @@ -248,7 +248,7 @@ cleanConflictCruft resolvedks resolvedfs unstagedmap = do | S.member f fs || S.member (conflictCruftBase f) fs = anyM id [ pure (S.member i is) , inks <$> isAnnexLink f - , inks <$> isPointerFile f + , inks <$> liftIO (isPointerFile f) ] | otherwise = return False diff --git a/Annex/Content.hs b/Annex/Content.hs index be460f068c..2a8b295d30 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -505,7 +505,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect alreadyhave = liftIO $ removeFile src populatePointerFile :: Key -> FilePath -> FilePath -> Annex () -populatePointerFile k obj f = go =<< isPointerFile f +populatePointerFile k obj f = go =<< liftIO (isPointerFile f) where go (Just k') | k == k' = do liftIO $ nukeFile f diff --git a/Annex/Link.hs b/Annex/Link.hs index 61c61b5613..7f1a1b14da 100644 --- a/Annex/Link.hs +++ b/Annex/Link.hs @@ -153,6 +153,6 @@ formatPointer k = toInternalGitPath (pathSeparator:objectDir key2file k) ++ "\n" {- Checks if a file is a pointer to a key. -} -isPointerFile :: FilePath -> Annex (Maybe Key) -isPointerFile f = liftIO $ catchDefaultIO Nothing $ +isPointerFile :: FilePath -> IO (Maybe Key) +isPointerFile f = catchDefaultIO Nothing $ parseLinkOrPointer <$> L.readFile f diff --git a/Command/Lock.hs b/Command/Lock.hs index 3fbe33d8a2..e4039dd8b8 100644 --- a/Command/Lock.hs +++ b/Command/Lock.hs @@ -41,7 +41,7 @@ startNew file key = ifM (isJust <$> isAnnexLink file) ( stop , do showStart "lock" file - go =<< isPointerFile file + go =<< liftIO (isPointerFile file) ) where go (Just key')