repository_head_unborn: clear error when HEAD is unborn
diff --git a/src/repository.c b/src/repository.c
index 51d39eb..f032c89 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1567,8 +1567,10 @@ int git_repository_head_unborn(git_repository *repo)
error = git_repository_head(&ref, repo);
git_reference_free(ref);
- if (error == GIT_EUNBORNBRANCH)
+ if (error == GIT_EUNBORNBRANCH) {
+ giterr_clear();
return 1;
+ }
if (error < 0)
return -1;