summaryrefslogtreecommitdiff
path: root/Backend/File.hs
diff options
context:
space:
mode:
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."