fsck improvements

This commit is contained in:
Joey Hess 2010-11-13 15:24:36 -04:00
parent 5fa25a812a
commit abebbcfd54
4 changed files with 30 additions and 14 deletions

View file

@ -169,10 +169,18 @@ checkKey a key = do
checkKeyNumCopies :: Key -> Annex Bool
checkKeyNumCopies key = do
needed <- getNumCopies
remotes <- Remotes.keyPossibilities key
numcopies <- getNumCopies
if (length remotes < numcopies)
inannex <- inAnnex key
let present = length remotes + if inannex then 1 else 0
if (present < needed)
then do
showLongNote $ "only " ++ show (length remotes) ++ " of " ++ show numcopies ++ " copies"
showLongNote $ note present needed
return False
else return True
where
note 0 _ = "** No known copies of the file exist!"
note present needed =
"Only " ++ show present ++ " of " ++ show needed ++
" copies exist. " ++
"Run git annex get somewhere else to back it up."