Commit 5ac2b7cb2ae67aa7a8a7b4d171c54ea69140516a

Carlos Martín Nieto 2015-03-03T13:03:54

Merge pull request #2937 from git-up/branch_delete_reflog git_branch_delete() should ignore errors from non-existing reflogs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/branch.c b/src/branch.c
index b4e4b05..06b93dd 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -138,8 +138,13 @@ 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 (git_reflog_delete(git_reference_owner(branch), git_reference_name(branch)) < 0) {
+		if (error == GIT_ENOTFOUND) {
+			giterr_clear();
+			error = 0;
+		}
 		goto on_error;
+	}
 
 	error = 0;