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
parent 372694fe
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment