avoid displaying error from git symbolic-ref -q HEAD
Usually this won't fail even if .git/HEAD is not set or points to a ref that doesn't exist. However, early in clone, it contains "ref: refs/heads/.invalid" which causes an error "fatal: No such ref: HEAD" When cloning from a special remote, git-remote-annex output that once per bundle.
This commit is contained in:
parent
2670508b97
commit
0ba2b89c71
1 changed files with 9 additions and 5 deletions
|
@ -40,15 +40,19 @@ current r = do
|
||||||
|
|
||||||
{- The current branch, which may not really exist yet. -}
|
{- The current branch, which may not really exist yet. -}
|
||||||
currentUnsafe :: Repo -> IO (Maybe Branch)
|
currentUnsafe :: Repo -> IO (Maybe Branch)
|
||||||
currentUnsafe r = parse . firstLine' <$> pipeReadStrict
|
currentUnsafe r = withNullHandle $ \nullh ->
|
||||||
[ Param "symbolic-ref"
|
parse . firstLine' <$> pipeReadStrict'
|
||||||
, Param "-q"
|
(\p -> p { std_err = UseHandle nullh })
|
||||||
, Param $ fromRef Git.Ref.headRef
|
ps r
|
||||||
] r
|
|
||||||
where
|
where
|
||||||
parse b
|
parse b
|
||||||
| B.null b = Nothing
|
| B.null b = Nothing
|
||||||
| otherwise = Just $ Git.Ref b
|
| otherwise = Just $ Git.Ref b
|
||||||
|
ps =
|
||||||
|
[ Param "symbolic-ref"
|
||||||
|
, Param "-q"
|
||||||
|
, Param $ fromRef Git.Ref.headRef
|
||||||
|
]
|
||||||
|
|
||||||
{- Checks if the second branch has any commits not present on the first
|
{- Checks if the second branch has any commits not present on the first
|
||||||
- branch. -}
|
- branch. -}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue