aboutsummaryrefslogtreecommitdiff
path: root/Git/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-20 18:31:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-20 18:31:00 -0400
commit346bc6528c7999756b652e8e3f0b33f26a48dbbd (patch)
treedd80cf717afe204f7030bc5fe929c3084a02f228 /Git/Fsck.hs
parent454848b42b2e22a28ba677435318d726ce627e75 (diff)
merge from git-repair
Diffstat (limited to 'Git/Fsck.hs')
-rw-r--r--Git/Fsck.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Git/Fsck.hs b/Git/Fsck.hs
index 2c9423005..85e60542b 100644
--- a/Git/Fsck.hs
+++ b/Git/Fsck.hs
@@ -40,7 +40,7 @@ type FsckResults = Maybe MissingObjects
findBroken :: Bool -> Repo -> IO FsckResults
findBroken batchmode r = do
(output, fsckok) <- processTranscript command' (toCommand params') Nothing
- let objs = parseFsckOutput output
+ let objs = findShas output
badobjs <- findMissing objs r
if S.null badobjs && not fsckok
then return Nothing
@@ -65,7 +65,7 @@ findMissing objs r = go objs [] =<< start
where
start = catFileStart' False r
go [] c h = do
- catFileStop h
+ void $ tryIO $ catFileStop h
return $ S.fromList c
go (o:os) c h = do
v <- tryIO $ isNothing <$> catObjectDetails h o
@@ -76,11 +76,11 @@ findMissing objs r = go objs [] =<< start
Right True -> go os (o:c) h
Right False -> go os c h
-parseFsckOutput :: String -> [Sha]
-parseFsckOutput = catMaybes . map extractSha . concat . map words . lines
+findShas :: String -> [Sha]
+findShas = catMaybes . map extractSha . concat . map words . lines
fsckParams :: Repo -> [CommandParam]
-fsckParams = gitCommandLine
+fsckParams = gitCommandLine $
[ Param "fsck"
, Param "--no-dangling"
, Param "--no-reflogs"