aboutsummaryrefslogtreecommitdiff
path: root/Git/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-11-12 15:41:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-11-12 15:51:46 -0400
commitbb7571aeb4d4cd4920a7fe4b2538ce5a412f7603 (patch)
tree3a9f998c60fd1a4fc5bad999b11aa1d4e2c4df3b /Git/Branch.hs
parent708944448479a4c8a1d47ba6db96def92960ad36 (diff)
proxy: for all your direct mode repository munging needs
This allows bypassing the direct mode guard in a safe way to do all sorts of things including git revert, git mv, git checkout ... This commit was sponsored by the WikiMedia Foundation.
Diffstat (limited to 'Git/Branch.hs')
-rw-r--r--Git/Branch.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs
index 0b7d888b8..1d5ffd39d 100644
--- a/Git/Branch.hs
+++ b/Git/Branch.hs
@@ -43,6 +43,12 @@ currentUnsafe r = parse . firstLine
| null l = Nothing
| otherwise = Just $ Git.Ref l
+currentSha :: Repo -> IO (Maybe Git.Sha)
+currentSha r = go =<< current r
+ where
+ go Nothing = return Nothing
+ go (Just ref) = Git.Ref.sha ref r
+
{- Checks if the second branch has any commits not present on the first
- branch. -}
changed :: Branch -> Branch -> Repo -> IO Bool