aboutsummaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-06-09 14:08:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-06-09 14:08:57 -0400
commitf80592f1603fdfdde4b092e9880646ded505163a (patch)
tree680902863f0f8805345e89f25f3a29eac4ec198b /Logs
parent951992f3535a33eaa867410e5985835c59f6b22a (diff)
fsck: Ignore keys that are known to be dead when running in --all mode or a in a bare repo. Otherwise, still reports files with lost contents, even if the content is dead.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Location.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Logs/Location.hs b/Logs/Location.hs
index 391edb680..5ad0ae4d0 100644
--- a/Logs/Location.hs
+++ b/Logs/Location.hs
@@ -8,7 +8,7 @@
- Repositories record their UUID and the date when they --get or --drop
- a value.
-
- - Copyright 2010-2014 Joey Hess <id@joeyh.name>
+ - Copyright 2010-2015 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -19,7 +19,8 @@ module Logs.Location (
logChange,
loggedLocations,
loggedLocationsHistorical,
- locationLog,
+ checkDead,
+ setDead,
loggedKeys,
loggedKeysFor,
) where
@@ -62,10 +63,18 @@ getLoggedLocations getter key = do
config <- Annex.getGitConfig
map toUUID <$> getter (locationLogFile config key)
-locationLog :: Key -> Annex [LogLine]
-locationLog key = do
+{- For a key to be dead, all locations that have location status for the key
+ - must have InfoDead set. -}
+checkDead :: Key -> Annex Bool
+checkDead key = do
config <- Annex.getGitConfig
- currentLog (locationLogFile config key)
+ ls <- compactLog <$> readLog (locationLogFile config key)
+ return $ all (\l -> status l == InfoDead) ls
+
+{- Updates the log to say that a key is dead. This changes all logged lines
+ - for the key, in any location, to be InfoDead. -}
+setDead :: Key -> Annex ()
+setDead key = undefined
{- Finds all keys that have location log information.
- (There may be duplicate keys in the list.) -}