CreateCommitWithSignature creates a commit object from the given contents and signature.
( commitContent, signature, signatureField string, )
| 491 | // CreateCommitWithSignature creates a commit object from the given contents and |
| 492 | // signature. |
| 493 | func (v *Repository) CreateCommitWithSignature( |
| 494 | commitContent, signature, signatureField string, |
| 495 | ) (*Oid, error) { |
| 496 | cCommitContent := C.CString(commitContent) |
| 497 | defer C.free(unsafe.Pointer(cCommitContent)) |
| 498 | var cSignature *C.char |
| 499 | if signature != "" { |
| 500 | cSignature = C.CString(string(signature)) |
| 501 | defer C.free(unsafe.Pointer(cSignature)) |
| 502 | } |
| 503 | var cSignatureField *C.char |
| 504 | if signatureField != "" { |
| 505 | cSignatureField = C.CString(string(signatureField)) |
| 506 | defer C.free(unsafe.Pointer(cSignatureField)) |
| 507 | } |
| 508 | |
| 509 | runtime.LockOSThread() |
| 510 | defer runtime.UnlockOSThread() |
| 511 | |
| 512 | oid := new(Oid) |
| 513 | ret := C.git_commit_create_with_signature(oid.toC(), v.ptr, cCommitContent, cSignature, cSignatureField) |
| 514 | |
| 515 | runtime.KeepAlive(v) |
| 516 | runtime.KeepAlive(oid) |
| 517 | if ret < 0 { |
| 518 | return nil, MakeGitError(ret) |
| 519 | } |
| 520 | |
| 521 | return oid, nil |
| 522 | } |
| 523 | |
| 524 | // CreateCommitBuffer creates a commit and write it into a buffer. |
| 525 | func (v *Repository) CreateCommitBuffer( |
no test coverage detected