diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-03-04 15:25:13 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-03-04 15:25:35 -0400 |
commit | 15ffb8b60e26bd8707c132f2452cb4adbe7e6d02 (patch) | |
tree | 3db0ba20a0f03c918af18afaa8481b591e9001b0 /Git | |
parent | 8ad7398e29c9bd2ec25274bcca808650778e1457 (diff) |
sync: Fix committing when in a direct mode repo that has no HEAD ref.
Seen for example, a newly checked out git submodule. In this case,
.git/HEAD is a raw sha, rather than the usual reference to a ref.
Removed currentSha in passing, since it was a more roundabout way of
doing what headSha does, and headSha is more robust.
Diffstat (limited to 'Git')
-rw-r--r-- | Git/Branch.hs | 3 | ||||
-rw-r--r-- | Git/Ref.hs | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Git/Branch.hs b/Git/Branch.hs index 523c641d7..a2225dc73 100644 --- a/Git/Branch.hs +++ b/Git/Branch.hs @@ -43,9 +43,6 @@ currentUnsafe r = parse . firstLine | null l = Nothing | otherwise = Just $ Git.Ref l -currentSha :: Repo -> IO (Maybe Git.Sha) -currentSha r = maybe (pure Nothing) (`Git.Ref.sha` r) =<< current r - {- Checks if the second branch has any commits not present on the first - branch. -} changed :: Branch -> Branch -> Repo -> IO Bool diff --git a/Git/Ref.hs b/Git/Ref.hs index 5ad7577ff..6bc47d5ed 100644 --- a/Git/Ref.hs +++ b/Git/Ref.hs @@ -88,6 +88,9 @@ sha branch repo = process <$> showref repo process [] = Nothing process s = Just $ Ref $ firstLine s +headSha :: Repo -> IO (Maybe Sha) +headSha = sha headRef + {- List of (shas, branches) matching a given ref or refs. -} matching :: [Ref] -> Repo -> IO [(Sha, Branch)] matching refs repo = matching' (map fromRef refs) repo |