2013-10-21 20:41:46 +00:00
|
|
|
{- git reflog interface
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
2013-10-21 20:41:46 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2013-10-21 20:41:46 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Git.RefLog where
|
|
|
|
|
|
|
|
import Common
|
|
|
|
import Git
|
|
|
|
import Git.Command
|
|
|
|
import Git.Sha
|
|
|
|
|
|
|
|
{- Gets the reflog for a given branch. -}
|
|
|
|
get :: Branch -> Repo -> IO [Sha]
|
2015-07-07 21:31:30 +00:00
|
|
|
get b = getMulti [b]
|
2015-03-26 15:15:15 +00:00
|
|
|
|
2015-07-07 21:31:30 +00:00
|
|
|
{- Gets reflogs for multiple branches. -}
|
|
|
|
getMulti :: [Branch] -> Repo -> IO [Sha]
|
|
|
|
getMulti bs = get' (map (Param . fromRef) bs)
|
2015-07-07 21:13:50 +00:00
|
|
|
|
2015-07-07 21:31:30 +00:00
|
|
|
get' :: [CommandParam] -> Repo -> IO [Sha]
|
|
|
|
get' ps = mapMaybe extractSha . lines <$$> pipeReadStrict ps'
|
2015-03-26 15:15:15 +00:00
|
|
|
where
|
2015-07-07 21:13:50 +00:00
|
|
|
ps' = catMaybes
|
|
|
|
[ Just $ Param "log"
|
|
|
|
, Just $ Param "-g"
|
|
|
|
, Just $ Param "--format=%H"
|
2015-03-26 15:15:15 +00:00
|
|
|
] ++ ps
|