aboutsummaryrefslogtreecommitdiff
path: root/Command/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-15 16:10:48 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-15 16:10:48 -0400
commit2a9c5f62e3e2676922905f09b1f2ca535354d884 (patch)
tree063b07b8b0bd8c10898ef7656c73e51a3403be0c /Command/Fsck.hs
parentd2f02e6fa778fa971405a0c4a5ac95a9dc88d6c9 (diff)
recent fsck changes caused ugly message when object was not present
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r--Command/Fsck.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 42bc93074..46de4ac96 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -299,7 +299,7 @@ verifyDirectMode key file = do
-}
checkKeySize :: Key -> KeyStatus -> Annex Bool
checkKeySize _ KeyUnlocked = return True
-checkKeySize key KeyLocked = do
+checkKeySize key _ = do
file <- calcRepo $ gitAnnexLocation key
ifM (liftIO $ doesFileExist file)
( checkKeySizeOr badContent key file
@@ -596,16 +596,17 @@ withFsckDb NonIncremental _ = noop
withFsckDb (ScheduleIncremental _ _ i) a = withFsckDb i a
#endif
-data KeyStatus = KeyLocked | KeyUnlocked
+data KeyStatus = KeyLocked | KeyUnlocked | KeyMissing
isKeyUnlocked :: KeyStatus -> Bool
isKeyUnlocked KeyUnlocked = True
isKeyUnlocked KeyLocked = False
+isKeyUnlocked KeyMissing = False
getKeyStatus :: Key -> Annex KeyStatus
getKeyStatus key = ifM isDirect
( return KeyUnlocked
- , do
+ , catchDefaultIO KeyMissing $ do
obj <- calcRepo $ gitAnnexLocation key
unlocked <- ((> 1) . linkCount <$> liftIO (getFileStatus obj))
<&&> (not . null <$> Database.Keys.getAssociatedFiles key)