summaryrefslogtreecommitdiff
path: root/Logs/FsckResults.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-30 14:29:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-30 14:29:11 -0400
commitf04b34c4584e18f4c722700eda5e80eb0345f035 (patch)
tree1c224b92daedc732fa7cd3970603874e8c1fafbe /Logs/FsckResults.hs
parent9c6587636ef68bd1551f65069118332c337dec48 (diff)
merge improved fsck types from git-repair and some associated changes
Diffstat (limited to 'Logs/FsckResults.hs')
-rw-r--r--Logs/FsckResults.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/Logs/FsckResults.hs b/Logs/FsckResults.hs
index 75ed7389c..8e776ec21 100644
--- a/Logs/FsckResults.hs
+++ b/Logs/FsckResults.hs
@@ -7,7 +7,8 @@
module Logs.FsckResults (
writeFsckResults,
- readFsckResults
+ readFsckResults,
+ clearFsckResults,
) where
import Common.Annex
@@ -22,8 +23,8 @@ writeFsckResults u fsckresults = do
logfile <- fromRepo $ gitAnnexFsckResultsLog u
liftIO $
case fsckresults of
- Nothing -> store S.empty logfile
- Just s
+ FsckFailed -> store S.empty logfile
+ FsckFoundMissing s
| S.null s -> nukeFile logfile
| otherwise -> store s logfile
where
@@ -35,9 +36,13 @@ writeFsckResults u fsckresults = do
readFsckResults :: UUID -> Annex FsckResults
readFsckResults u = do
logfile <- fromRepo $ gitAnnexFsckResultsLog u
- liftIO $ catchDefaultIO (Just S.empty) $
+ liftIO $ catchDefaultIO (FsckFoundMissing S.empty) $
deserialize <$> readFile logfile
where
deserialize l =
let s = S.fromList $ map Ref $ lines l
- in if S.null s then Nothing else Just s
+ in if S.null s then FsckFailed else FsckFoundMissing s
+
+clearFsckResults :: UUID -> Annex ()
+clearFsckResults = liftIO . nukeFile <=< fromRepo . gitAnnexFsckResultsLog
+