Skip to content

Commit 3d8c54b

Browse files
committed
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 parent 372694f commit 3d8c54b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rebase.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,12 @@ static int rebase_commit__create(
986986
message_encoding, message, tree, 1, (const git_commit **)&parent_commit)) < 0)
987987
goto done;
988988

989+
git_error_clear();
989990
if ((error = rebase->options.signing_cb(&commit_signature, &signature_field,
990991
git_buf_cstr(&commit_content), rebase->options.payload)) < 0 &&
991992
error != GIT_PASSTHROUGH) {
992-
git_error_set(error, "signing_cb failed");
993+
if (git_error_last() == NULL)
994+
git_error_set(GIT_ERROR_CALLBACK, "commit signing_cb failed");
993995
goto done;
994996
}
995997

0 commit comments

Comments
 (0)