Commit 31bc6c044091c4d65f3a6fd7078beb260c210137

Carlos Martín Nieto 2015-03-03T13:25:40

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.

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