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
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;
}