summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
Diffstat (limited to 'Backend')
-rw-r--r--Backend/File.hs14
-rw-r--r--Backend/SHA1.hs2
-rw-r--r--Backend/WORM.hs2
3 files changed, 13 insertions, 5 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."
diff --git a/Backend/SHA1.hs b/Backend/SHA1.hs
index 8852e72e9..9e9000ba9 100644
--- a/Backend/SHA1.hs
+++ b/Backend/SHA1.hs
@@ -57,5 +57,5 @@ checkKeySHA1 key = do
then return True
else do
dest <- moveBad key
- showNote $ "bad file content (moved to "++dest++")"
+ showLongNote $ "Bad file content; moved to "++dest
return False
diff --git a/Backend/WORM.hs b/Backend/WORM.hs
index 21b3876b9..e53ec6de7 100644
--- a/Backend/WORM.hs
+++ b/Backend/WORM.hs
@@ -66,5 +66,5 @@ checkKeySize key = do
then return True
else do
dest <- moveBad key
- showNote $ "bad file size (moved to "++dest++")"
+ showLongNote $ "Bad file size; moved to "++dest
return False