aboutsummaryrefslogtreecommitdiff
path: root/Git/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-21 15:28:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-21 15:28:06 -0400
commit727566ad23efc6c36a4a4473b3299af913f6ce03 (patch)
tree8dd85a47703021db232b02e47d371037cb0715c3 /Git/Fsck.hs
parent1f7604f7d9df831012893a9ee2b4a8be20fe02ab (diff)
implemented removal of corrupt tracking branches
Oh, git, you made this so hard. Not determining if a branch pointed to some corrupt object, that was easy, but dealing with corrupt branches using git plumbing is a PITA.
Diffstat (limited to 'Git/Fsck.hs')
-rw-r--r--Git/Fsck.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Git/Fsck.hs b/Git/Fsck.hs
index a43a84f3e..5fdc73385 100644
--- a/Git/Fsck.hs
+++ b/Git/Fsck.hs
@@ -7,7 +7,8 @@
module Git.Fsck (
findBroken,
- findMissing
+ findMissing,
+ MissingObjects
) where
import Common
@@ -18,6 +19,8 @@ import Git.CatFile
import qualified Data.Set as S
+type MissingObjects = S.Set Sha
+
{- Runs fsck to find some of the broken objects in the repository.
- May not find all broken objects, if fsck fails on bad data in some of
- the broken objects it does find. If the fsck fails generally without
@@ -28,7 +31,7 @@ import qualified Data.Set as S
- to be a git sha. Not all such shas are of broken objects, so ask git
- to try to cat the object, and see if it fails.
-}
-findBroken :: Repo -> IO (Maybe (S.Set Sha))
+findBroken :: Repo -> IO (Maybe MissingObjects)
findBroken r = do
(output, fsckok) <- processTranscript "git" (toCommand $ fsckParams r) Nothing
let objs = parseFsckOutput output
@@ -39,7 +42,7 @@ findBroken r = do
{- Finds objects that are missing from the git repsitory, or are corrupt.
- Note that catting a corrupt object will cause cat-file to crash. -}
-findMissing :: [Sha] -> Repo -> IO (S.Set Sha)
+findMissing :: [Sha] -> Repo -> IO MissingObjects
findMissing objs r = go objs [] =<< start
where
start = catFileStart' False r