aboutsummaryrefslogtreecommitdiff
path: root/Git/Fsck.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Git/Fsck.hs')
-rw-r--r--Git/Fsck.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/Git/Fsck.hs b/Git/Fsck.hs
index a716b56e3..a1b42a953 100644
--- a/Git/Fsck.hs
+++ b/Git/Fsck.hs
@@ -1,6 +1,7 @@
{- git fsck interface
-
- Copyright 2013 Joey Hess <id@joeyh.name>
+ - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -44,15 +45,17 @@ type MissingObjects = S.Set Sha
type Truncated = Bool
+instance Semigroup FsckOutput where
+ FsckOutput s1 t1 <> FsckOutput s2 t2 = FsckOutput (S.union s1 s2) (t1 || t2)
+ FsckOutput s t <> _ = FsckOutput s t
+ _ <> FsckOutput s t = FsckOutput s t
+ NoFsckOutput <> NoFsckOutput = NoFsckOutput
+ AllDuplicateEntriesWarning <> AllDuplicateEntriesWarning = AllDuplicateEntriesWarning
+ AllDuplicateEntriesWarning <> NoFsckOutput = AllDuplicateEntriesWarning
+ NoFsckOutput <> AllDuplicateEntriesWarning = AllDuplicateEntriesWarning
+
instance Monoid FsckOutput where
mempty = NoFsckOutput
- mappend (FsckOutput s1 t1) (FsckOutput s2 t2) = FsckOutput (S.union s1 s2) (t1 || t2)
- mappend (FsckOutput s t) _ = FsckOutput s t
- mappend _ (FsckOutput s t) = FsckOutput s t
- mappend NoFsckOutput NoFsckOutput = NoFsckOutput
- mappend AllDuplicateEntriesWarning AllDuplicateEntriesWarning = AllDuplicateEntriesWarning
- mappend AllDuplicateEntriesWarning NoFsckOutput = AllDuplicateEntriesWarning
- mappend NoFsckOutput AllDuplicateEntriesWarning = AllDuplicateEntriesWarning
{- 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