summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Location.hs19
1 files changed, 13 insertions, 6 deletions
diff --git a/Logs/Location.hs b/Logs/Location.hs
index 62875985f..5ead34be6 100644
--- a/Logs/Location.hs
+++ b/Logs/Location.hs
@@ -86,7 +86,7 @@ checkDead :: Key -> Annex Bool
checkDead key = do
config <- Annex.getGitConfig
ls <- compactLog <$> readLog (locationLogFile config key)
- return $ all (\l -> status l == InfoDead) ls
+ return $! all (\l -> status l == InfoDead) ls
{- Updates the log to say that a key is dead.
-
@@ -111,17 +111,24 @@ setDead' l = l
}
{- Finds all keys that have location log information.
- - (There may be duplicate keys in the list.) -}
+ - (There may be duplicate keys in the list.)
+ -
+ - Keys that have been marked as dead are not included.
+ -}
loggedKeys :: Annex [Key]
-loggedKeys = mapMaybe locationLogFileKey <$> Annex.Branch.files
+loggedKeys = loggedKeys' (not <$$> checkDead)
+
+{- Note that sel should be strict, to avoid the filterM building many
+ - thunks. -}
+loggedKeys' :: (Key -> Annex Bool) -> Annex [Key]
+loggedKeys' sel = filterM sel =<<
+ (mapMaybe locationLogFileKey <$> Annex.Branch.files)
{- Finds all keys that have location log information indicating
- they are present for the specified repository. -}
loggedKeysFor :: UUID -> Annex [Key]
-loggedKeysFor u = filterM isthere =<< loggedKeys
+loggedKeysFor u = loggedKeys' isthere
where
- {- This should run strictly to avoid the filterM
- - building many thunks containing keyLocations data. -}
isthere k = do
us <- loggedLocations k
let !there = u `elem` us