mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
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.
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user