summaryrefslogtreecommitdiff
path: root/Git/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-31 14:32:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-31 14:32:59 -0400
commit09905f66559f964ad36dc40da03d4f7f96804a91 (patch)
treeb871c8a2372e6cba00aaa9b707c091f65837016b /Git/Branch.hs
parent38195a6363e54874ce072eb2d3ced448e0b68e02 (diff)
parentf0957426c586610d16ad9694e002b73324baa29a (diff)
Merge branch 'autosync'
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r--Git/Branch.hs8
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