diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-30 18:36:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-30 18:36:40 -0400 |
commit | 52104dae6f5175f01395a657fd40423d1196604a (patch) | |
tree | 804e1f76ee4cd930375d13f70121a634fe675dcd /Git | |
parent | 56488e807bcc7dcc6e9f5b3e359ddf4f4fb5d8d1 (diff) |
refactor
Diffstat (limited to 'Git')
-rw-r--r-- | Git/Ref.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs index 3341cf648..557d24a37 100644 --- a/Git/Ref.hs +++ b/Git/Ref.hs @@ -48,13 +48,18 @@ sha branch repo = process . L.unpack <$> showref repo process [] = Nothing process s = Just $ Ref $ firstLine s -{- List of (refs, branches) matching a given ref spec. - - Duplicate refs are filtered out. -} +{- List of (refs, branches) matching a given ref spec. -} matching :: Ref -> Repo -> IO [(Ref, Branch)] matching ref repo = do r <- pipeRead [Param "show-ref", Param $ show ref] repo - return $ nubBy uniqref $ map (gen . L.unpack) (L.lines r) + return $ map (gen . L.unpack) (L.lines r) where - uniqref (a, _) (b, _) = a == b gen l = let (r, b) = separate (== ' ') l in (Ref r, Ref b) + +{- List of (refs, branches) matching a given ref spec. + - Duplicate refs are filtered out. -} +matchingUniq :: Ref -> Repo -> IO [(Ref, Branch)] +matchingUniq ref repo = nubBy uniqref <$> matching ref repo + where + uniqref (a, _) (b, _) = a == b |