Commit 3d8c54be6b5f4e5643567cfba0d1eaee0e83b050

Tyler Wanek 2019-02-21T09:27:16

Clear error before calling signing_cb, set error if one has not been set We should clear the error before calling the signing_cb to allow the signing_cb to set its own errors. If the CB did not provide an error, we should set our own generic error before exiting rebase_commit__create

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/rebase.c b/src/rebase.c
index e313db9..6aef859 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -986,10 +986,12 @@ static int rebase_commit__create(
 				message_encoding, message, tree, 1, (const git_commit **)&parent_commit)) < 0)
 			goto done;
 
+		git_error_clear();
 		if ((error = rebase->options.signing_cb(&commit_signature, &signature_field,
 				git_buf_cstr(&commit_content), rebase->options.payload)) < 0 &&
 				error != GIT_PASSTHROUGH) {
-			git_error_set(error, "signing_cb failed");
+			if (git_error_last() == NULL)
+				git_error_set(GIT_ERROR_CALLBACK, "commit signing_cb failed");
 			goto done;
 		}