diff options
Diffstat (limited to 'Annex/WorkTree.hs')
-rw-r--r-- | Annex/WorkTree.hs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Annex/WorkTree.hs b/Annex/WorkTree.hs index d62e15aee..4496561c9 100644 --- a/Annex/WorkTree.hs +++ b/Annex/WorkTree.hs @@ -30,17 +30,15 @@ import qualified Database.Keys.SQL - looking for a pointer to a key in git. -} lookupFile :: FilePath -> Annex (Maybe Key) -lookupFile file = do - mkey <- isAnnexLink file - case mkey of - Just key -> makeret key - Nothing -> ifM (versionSupportsUnlockedPointers <||> isDirect) - ( ifM (liftIO $ doesFileExist file) - ( maybe (return Nothing) makeret =<< catKeyFile file - , return Nothing - ) - , return Nothing +lookupFile file = isAnnexLink file >>= \case + Just key -> makeret key + Nothing -> ifM (versionSupportsUnlockedPointers <||> isDirect) + ( ifM (liftIO $ doesFileExist file) + ( maybe (return Nothing) makeret =<< catKeyFile file + , return Nothing ) + , return Nothing + ) where makeret = return . Just @@ -84,9 +82,8 @@ scanUnlockedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ do whenM (inAnnex k) $ do f <- fromRepo $ fromTopFilePath tf destmode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus f - replaceFile f $ \tmp -> do - r <- linkFromAnnex k tmp destmode - case r of + replaceFile f $ \tmp -> + linkFromAnnex k tmp destmode >>= \case LinkAnnexOk -> return () LinkAnnexNoop -> return () LinkAnnexFailed -> liftIO $ |