Commit 7c9bf891d5fa5a61dd91f2432bbfff7da325e062

Edward Thomson 2014-10-03T19:34:37

repository_head_unborn: clear error when HEAD is unborn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;