diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-31 03:38:58 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-31 03:38:58 -0400 |
commit | a2ec2d3760f5ae17836ade3b0238dde7f9de5bd2 (patch) | |
tree | d15b531723ca09eb4060dd9c6ae03e4ad39da4cb /Git/Branch.hs | |
parent | 8a33573caff38b557fdf60c9547a78a5cc8c4ddc (diff) |
refactor and check for a detached HEAD
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r-- | Git/Branch.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs index cce56dcfa..98811a987 100644 --- a/Git/Branch.hs +++ b/Git/Branch.hs @@ -14,6 +14,14 @@ import Git import Git.Sha import Git.Command +{- The currently checked out branch. -} +current :: Repo -> IO (Maybe Git.Ref) +current r = parse <$> pipeRead [Param "symbolic-ref", Param "HEAD"] r + where + parse v + | L.null v = Nothing + | otherwise = Just $ Git.Ref $ firstLine $ L.unpack v + {- Checks if the second branch has any commits not present on the first - branch. -} changed :: Branch -> Branch -> Repo -> IO Bool |