diff options
Diffstat (limited to 'Git/RefLog.hs')
-rw-r--r-- | Git/RefLog.hs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Git/RefLog.hs b/Git/RefLog.hs index 7c20047ad..940bb10a1 100644 --- a/Git/RefLog.hs +++ b/Git/RefLog.hs @@ -14,14 +14,18 @@ import Git.Sha {- Gets the reflog for a given branch. -} get :: Branch -> Repo -> IO [Sha] -get = get' [] +get b = get' [] (Just b) -get' :: [CommandParam] -> Branch -> Repo -> IO [Sha] +{- Gets all reflogs for all branches. -} +getAll :: Repo -> IO [Sha] +getAll = get' [Param "--all"] Nothing + +get' :: [CommandParam] -> Maybe Branch -> Repo -> IO [Sha] get' ps b = mapMaybe extractSha . lines <$$> pipeReadStrict ps' where - ps' = - [ Param "log" - , Param "-g" - , Param "--format=%H" - , Param (fromRef b) + ps' = catMaybes + [ Just $ Param "log" + , Just $ Param "-g" + , Just $ Param "--format=%H" + , Param . fromRef <$> b ] ++ ps |