summaryrefslogtreecommitdiff
path: root/Logs/Group.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/Group.hs')
-rw-r--r--Logs/Group.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Logs/Group.hs b/Logs/Group.hs
index a069edcdf..85906f0a7 100644
--- a/Logs/Group.hs
+++ b/Logs/Group.hs
@@ -13,6 +13,7 @@ module Logs.Group (
groupMap,
groupMapLoad,
getStandardGroup,
+ inUnwantedGroup
) where
import qualified Data.Map as M
@@ -66,11 +67,15 @@ makeGroupMap :: M.Map UUID (S.Set Group) -> GroupMap
makeGroupMap byuuid = GroupMap byuuid bygroup
where
bygroup = M.fromListWith S.union $
- concat $ map explode $ M.toList byuuid
+ concatMap explode $ M.toList byuuid
explode (u, s) = map (\g -> (g, S.singleton u)) (S.toList s)
{- If a repository is in exactly one standard group, returns it. -}
getStandardGroup :: S.Set Group -> Maybe StandardGroup
-getStandardGroup s = case catMaybes $ map toStandardGroup $ S.toList s of
+getStandardGroup s = case mapMaybe toStandardGroup $ S.toList s of
[g] -> Just g
_ -> Nothing
+
+inUnwantedGroup :: UUID -> Annex Bool
+inUnwantedGroup u = elem UnwantedGroup
+ . mapMaybe toStandardGroup . S.toList <$> lookupGroups u