summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-26 20:37:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-26 20:37:46 -0400
commite1d213d6e3c9fe0cda6e2b80c4abeb17db5d3a16 (patch)
tree93582f5e205a144f49a937b3b7ae5d1084469a6f /Backend
parentc30d38e108ade7eb4fa57552631b64dd3b9582c4 (diff)
make filename available to fsck messages
Diffstat (limited to 'Backend')
-rw-r--r--Backend/File.hs16
-rw-r--r--Backend/URL.hs4
2 files changed, 11 insertions, 9 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 10304dd91..26a6add1a 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -166,14 +166,14 @@ getNumCopies Nothing = do
- The passed action is first run to allow backends deriving this one
- to do their own checks.
-}
-checkKey :: (Key -> Annex Bool) -> Key -> Maybe Int -> Annex Bool
-checkKey a key numcopies = do
+checkKey :: (Key -> Annex Bool) -> Key -> Maybe FilePath -> Maybe Int -> Annex Bool
+checkKey a key file numcopies = do
a_ok <- a key
- copies_ok <- checkKeyNumCopies key numcopies
+ copies_ok <- checkKeyNumCopies key file numcopies
return $ a_ok && copies_ok
-checkKeyNumCopies :: Key -> Maybe Int -> Annex Bool
-checkKeyNumCopies key numcopies = do
+checkKeyNumCopies :: Key -> Maybe FilePath -> Maybe Int -> Annex Bool
+checkKeyNumCopies key file numcopies = do
needed <- getNumCopies numcopies
g <- Annex.gitRepo
locations <- liftIO $ keyLocations g key
@@ -184,10 +184,12 @@ checkKeyNumCopies key numcopies = do
if present < needed
then do
ppuuids <- prettyPrintUUIDs untrustedlocations
- warning $ missingNote (show key) present needed ppuuids
+ warning $ missingNote (filename file key) present needed ppuuids
return False
else return True
where
+ filename Nothing k = show k
+ filename (Just f) _ = f
missingNote :: String -> Int -> Int -> String -> String
missingNote file 0 _ [] =
@@ -203,5 +205,5 @@ missingNote file present needed [] =
"\nBack it up with git-annex copy."
missingNote file present needed untrusted =
missingNote file present needed [] ++
- "\nThe following untrusted copies may also exist: " ++
+ "\nThe following untrusted locations may also have copies: " ++
"\n" ++ untrusted
diff --git a/Backend/URL.hs b/Backend/URL.hs
index 45a204b07..38954e5a3 100644
--- a/Backend/URL.hs
+++ b/Backend/URL.hs
@@ -41,8 +41,8 @@ dummyStore _ _ = return False
dummyRemove :: Key -> Maybe a -> Annex Bool
dummyRemove _ _ = return False
-dummyFsck :: Key -> Maybe a -> Annex Bool
-dummyFsck _ _ = return True
+dummyFsck :: Key -> Maybe FilePath -> Maybe a -> Annex Bool
+dummyFsck _ _ _ = return True
dummyOk :: Key -> Annex Bool
dummyOk _ = return True