Commit c928d96e by Edward Thomson

clone: narrow success tests on HEAD-less remotes

Only allow the remote default branch checking to fail when the remote
default branch doesn't exist (`git_remote__default_branch` returns
`GIT_ENOTFOUND`). If there was any other type of error - for example, an
allocation failure - we should not swallow that and continue to fail.

This allows us to support the case when a remote has not advertised a
HEAD -- this is possible, for example, when the remote has constrained
the caller to a particular namespace. But other remote failures remain
as failures.
parent ed277684
......@@ -282,7 +282,11 @@ static int update_head_to_branch(
reflog_message)) < 0)
goto cleanup;
if (git_remote__default_branch(&default_branch, remote) < 0)
retcode = git_remote__default_branch(&default_branch, remote);
if (retcode == GIT_ENOTFOUND)
retcode = 0;
else if (retcode)
goto cleanup;
if (!git_remote__matching_refspec(remote, git_str_cstr(&default_branch)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment