diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-02-19 15:12:11 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-02-19 15:12:11 -0400 |
commit | 3a1e7bbc58363b8b9ef223a3fdc0f87db8b020f5 (patch) | |
tree | 1ea8f39f23945fdeb9754ae99d341c1cf97197d1 | |
parent | 6d4b67cb213ed74661bee8315d0048e99d8ef386 (diff) |
fsck: When the only copy of a file is in a dead repository, mention the repository.
-rw-r--r-- | Command/Fsck.hs | 30 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 3b31b7211..2e7579b5b 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -409,7 +409,9 @@ checkBackendOr' bad backend key file postcheck = checkKeyNumCopies :: Key -> AssociatedFile -> NumCopies -> Annex Bool checkKeyNumCopies key afile numcopies = do let file = fromMaybe (key2file key) afile - (untrustedlocations, safelocations) <- trustPartition UnTrusted =<< Remote.keyLocations key + locs <- loggedLocations key + (untrustedlocations, otherlocations) <- trustPartition UnTrusted locs + (deadlocations, safelocations) <- trustPartition DeadTrusted otherlocations let present = NumCopies (length safelocations) if present < numcopies then ifM (pure (isNothing afile) <&&> checkDead key) @@ -417,29 +419,35 @@ checkKeyNumCopies key afile numcopies = do showLongNote $ "This key is dead, skipping." return True , do - ppuuids <- Remote.prettyPrintUUIDs "untrusted" untrustedlocations - warning $ missingNote file present numcopies ppuuids + untrusted <- Remote.prettyPrintUUIDs "untrusted" untrustedlocations + dead <- Remote.prettyPrintUUIDs "dead" deadlocations + warning $ missingNote file present numcopies untrusted dead when (fromNumCopies present == 0 && isNothing afile) $ showLongNote "(Avoid this check by running: git annex dead --key )" return False ) else return True -missingNote :: String -> NumCopies -> NumCopies -> String -> String -missingNote file (NumCopies 0) _ [] = - "** No known copies exist of " ++ file -missingNote file (NumCopies 0) _ untrusted = +missingNote :: String -> NumCopies -> NumCopies -> String -> String -> String +missingNote file (NumCopies 0) _ [] dead = + "** No known copies exist of " ++ file ++ honorDead dead +missingNote file (NumCopies 0) _ untrusted dead = "Only these untrusted locations may have copies of " ++ file ++ "\n" ++ untrusted ++ - "Back it up to trusted locations with git-annex copy." -missingNote file present needed [] = + "Back it up to trusted locations with git-annex copy." ++ honorDead dead +missingNote file present needed [] _ = "Only " ++ show (fromNumCopies present) ++ " of " ++ show (fromNumCopies needed) ++ " trustworthy copies exist of " ++ file ++ "\nBack it up with git-annex copy." -missingNote file present needed untrusted = - missingNote file present needed [] ++ +missingNote file present needed untrusted dead = + missingNote file present needed [] dead ++ "\nThe following untrusted locations may also have copies: " ++ "\n" ++ untrusted + +honorDead :: String -> String +honorDead dead + | null dead = "" + | otherwise = "\nThese dead repositories used to have copies\n" ++ dead {- Bad content is moved aside. -} badContent :: Key -> Annex String diff --git a/debian/changelog b/debian/changelog index 36f82b00d..986414fb1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ git-annex (6.20160218) UNRELEASED; urgency=medium * Fix memory leak in last release, which affected commands like git-annex status when a large non-annexed file is present in the work tree. + * fsck: When the only copy of a file is in a dead repository, mention + the repository. -- Joey Hess <id@joeyh.name> Thu, 18 Feb 2016 13:09:21 -0400 |