enable short-circuiting optimisatons

This commit is contained in:
Joey Hess 2011-09-28 17:38:41 -04:00
parent b4d5c10fb7
commit 8e4bd621b9

View file

@ -161,7 +161,7 @@ unusedKeys = do
{- Finds keys in the list that are not referenced in the git repository. -} {- Finds keys in the list that are not referenced in the git repository. -}
excludeReferenced :: [Key] -> Annex [Key] excludeReferenced :: [Key] -> Annex [Key]
-- excludeReferenced [] = return [] -- optimisation excludeReferenced [] = return [] -- optimisation
excludeReferenced l = do excludeReferenced l = do
g <- Annex.gitRepo g <- Annex.gitRepo
c <- liftIO $ Git.pipeRead g [Param "show-ref"] c <- liftIO $ Git.pipeRead g [Param "show-ref"]
@ -180,7 +180,7 @@ excludeReferenced l = do
excludeReferenced' :: ([Annex [Key]]) -> S.Set Key -> Annex [Key] excludeReferenced' :: ([Annex [Key]]) -> S.Set Key -> Annex [Key]
excludeReferenced' [] s = return $ S.toList s excludeReferenced' [] s = return $ S.toList s
excludeReferenced' (a:as) s excludeReferenced' (a:as) s
-- | s == S.empty = return [] -- optimisation | s == S.empty = return [] -- optimisation
| otherwise = do | otherwise = do
referenced <- a referenced <- a
let !s' = remove referenced let !s' = remove referenced