mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 00:12:15 +00:00
remote: short-circuit the default branch check if there is none
If we do not have a HEAD ref in the heads, we already know there is no default branch. Return immedately.
This commit is contained in:
parent
94412b009e
commit
0cdaa3766a
@ -1955,6 +1955,9 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
|
|||||||
if (heads_len == 0)
|
if (heads_len == 0)
|
||||||
return GIT_ENOTFOUND;
|
return GIT_ENOTFOUND;
|
||||||
|
|
||||||
|
if (strcmp(heads[0]->name, GIT_HEAD_FILE))
|
||||||
|
return GIT_ENOTFOUND;
|
||||||
|
|
||||||
git_buf_sanitize(out);
|
git_buf_sanitize(out);
|
||||||
/* the first one must be HEAD so if that has the symref info, we're done */
|
/* the first one must be HEAD so if that has the symref info, we're done */
|
||||||
if (heads[0]->symref_target)
|
if (heads[0]->symref_target)
|
||||||
|
Loading…
Reference in New Issue
Block a user