Make it possible to use a git2go error as a return value from a signing callback and have it propagate

This commit is contained in:
Michael Boulton 2020-08-14 15:51:43 +01:00
parent 1ec8a67fe4
commit 23fcabf687
No known key found for this signature in database
GPG Key ID: 8A62CA0BE2E0197E
1 changed files with 3 additions and 0 deletions

View File

@ -86,6 +86,9 @@ func commitSignCallback(_signature *C.git_buf, _signature_field *C.git_buf, _com
signature, signatureField, err := opts.SigningCallback(commitContent)
if err != nil {
if gitError, ok := err.(*GitError); ok {
return C.int(gitError.Code)
}
return C.int(-1)
}