summaryrefslogtreecommitdiff
path: root/src/branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/branch.c')
-rw-r--r--src/branch.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/branch.c b/src/branch.c
index d0bd1c45b..991314508 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -265,13 +265,19 @@ int git_branch_is_head(
{
git_reference *head;
bool is_same = false;
+ int error;
assert(branch);
if (!git_reference_is_branch(branch))
return false;
- if (git_repository_head(&head, git_reference_owner(branch)) < 0)
+ error = git_repository_head(&head, git_reference_owner(branch));
+
+ if (error == GIT_EORPHANEDHEAD)
+ return false;
+
+ if (error < 0)
return -1;
is_same = strcmp(