summaryrefslogtreecommitdiff
path: root/Backend/File.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-13 15:24:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-13 15:24:36 -0400
commitabebbcfd544953f3a2c9dab042368069fd2d916a (patch)
tree073e9f00bc566f76adc8446fd02539d8aea26d45 /Backend/File.hs
parent5fa25a812a8a03af9f6a5fdb3d06eb4d89ee06f5 (diff)
fsck improvements
Diffstat (limited to 'Backend/File.hs')
-rw-r--r--Backend/File.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 9bda0d571..835177856 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -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."