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.
This commit is contained in:
parent
79b6500111
commit
a6db10d565
5 changed files with 16 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue