In commit 6bb35878 ("clone: set refs/remotes/origin/HEAD to default branch when branch is specified, attempt 2") libgit2 was changed to set the default remote branch when one was copied. But it makes update_head_to_branch() return an error if the origin doesn't even *have* a HEAD in the first place, since git_remote_default_branch() will fail. That's entirely wrong, and means that you cannot do "git_clone()" of a particular branch on a remote repository when that remote doesn't have a default branch at all. So don't set the error code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>