branch: do capture the error code We want to ignore GIT_ENOTFOUND, but for that we need to capture the error code from the reflog deletion.
diff --git a/src/branch.c b/src/branch.c
index 06b93dd..b39d747 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -138,7 +138,7 @@ int git_branch_delete(git_reference *branch)
if (git_reference_delete(branch) < 0)
goto on_error;
- if (git_reflog_delete(git_reference_owner(branch), git_reference_name(branch)) < 0) {
+ if ((error = git_reflog_delete(git_reference_owner(branch), git_reference_name(branch))) < 0) {
if (error == GIT_ENOTFOUND) {
giterr_clear();
error = 0;