convert isPointerFile from Annex to IO

This commit is contained in:
Joey Hess 2016-01-01 13:22:38 -04:00
parent 00f0411d12
commit a2c056df65
Failed to extract signature
4 changed files with 5 additions and 5 deletions

View file

@ -248,7 +248,7 @@ cleanConflictCruft resolvedks resolvedfs unstagedmap = do
| S.member f fs || S.member (conflictCruftBase f) fs = anyM id | S.member f fs || S.member (conflictCruftBase f) fs = anyM id
[ pure (S.member i is) [ pure (S.member i is)
, inks <$> isAnnexLink f , inks <$> isAnnexLink f
, inks <$> isPointerFile f , inks <$> liftIO (isPointerFile f)
] ]
| otherwise = return False | otherwise = return False

View file

@ -505,7 +505,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
alreadyhave = liftIO $ removeFile src alreadyhave = liftIO $ removeFile src
populatePointerFile :: Key -> FilePath -> FilePath -> Annex () populatePointerFile :: Key -> FilePath -> FilePath -> Annex ()
populatePointerFile k obj f = go =<< isPointerFile f populatePointerFile k obj f = go =<< liftIO (isPointerFile f)
where where
go (Just k') | k == k' = do go (Just k') | k == k' = do
liftIO $ nukeFile f liftIO $ nukeFile f

View file

@ -153,6 +153,6 @@ formatPointer k =
toInternalGitPath (pathSeparator:objectDir </> key2file k) ++ "\n" toInternalGitPath (pathSeparator:objectDir </> key2file k) ++ "\n"
{- Checks if a file is a pointer to a key. -} {- Checks if a file is a pointer to a key. -}
isPointerFile :: FilePath -> Annex (Maybe Key) isPointerFile :: FilePath -> IO (Maybe Key)
isPointerFile f = liftIO $ catchDefaultIO Nothing $ isPointerFile f = catchDefaultIO Nothing $
parseLinkOrPointer <$> L.readFile f parseLinkOrPointer <$> L.readFile f

View file

@ -41,7 +41,7 @@ startNew file key = ifM (isJust <$> isAnnexLink file)
( stop ( stop
, do , do
showStart "lock" file showStart "lock" file
go =<< isPointerFile file go =<< liftIO (isPointerFile file)
) )
where where
go (Just key') go (Just key')