Add check for empty path and better error messaging

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
Somtochi Onyekwere
2021-10-08 17:51:27 +01:00
committed by Hidde Beydals
parent e926321094
commit 25283d357e
2 changed files with 10 additions and 5 deletions

View File

@ -27,6 +27,11 @@ func (w GpgSigningOption) ApplyToCommit(in *CommitOptions) {
}
func WithGpgSigningOption(path, passphrase, keyID string) Option {
// return nil info if no path is set
if path == "" {
return GpgSigningOption{}
}
return GpgSigningOption{
GPGSigningInfo: &GPGSigningInfo{
PrivateKeyPath: path,