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. -}
|
||||
currentUnsafe :: Repo -> IO (Maybe Branch)
|
||||
currentUnsafe r = parse . firstLine' <$> pipeReadStrict
|
||||
[ Param "symbolic-ref"
|
||||
, Param "-q"
|
||||
, Param $ fromRef Git.Ref.headRef
|
||||
] r
|
||||
currentUnsafe r = withNullHandle $ \nullh ->
|
||||
parse . firstLine' <$> pipeReadStrict'
|
||||
(\p -> p { std_err = UseHandle nullh })
|
||||
ps r
|
||||
where
|
||||
parse b
|
||||
| B.null b = Nothing
|
||||
| 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
|
||||
- branch. -}
|
||||
|
|
Loading…
Reference in a new issue