diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | Logs/Location.hs | 19 | ||||
-rw-r--r-- | doc/git-annex-dead.mdwn | 5 |
3 files changed, 17 insertions, 8 deletions
@@ -21,6 +21,7 @@ git-annex (6.20170322) UNRELEASED; urgency=medium This was never supported before. * git annex add -u now supported, analagous to git add -u * version: Added "dependency versions" line. + * Keys marked as dead are now skipped by --all. -- Joey Hess <id@joeyh.name> Wed, 29 Mar 2017 12:41:46 -0400 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 diff --git a/doc/git-annex-dead.mdwn b/doc/git-annex-dead.mdwn index 804bb419a..d7acaa2d5 100644 --- a/doc/git-annex-dead.mdwn +++ b/doc/git-annex-dead.mdwn @@ -17,8 +17,9 @@ Repositories can be specified using their remote name, their description, or their UUID. (To undo, use `git-annex semitrust`.) When a key is specified, indicates that the content of that key has been -irretrievably lost. This prevents `git annex fsck --all` from complaining -about it. (To undo, add the key's content back to the repository, +irretrievably lost. This prevents commands like `git annex fsck --all` +from complaining about it; `--all` will not operate on the key anymore. +(To undo, add the key's content back to the repository, by using eg, `git-annex reinject`.) # SEE ALSO |