()
| 38 | } |
| 39 | |
| 40 | func (patch *Patch) String() (string, error) { |
| 41 | if patch.ptr == nil { |
| 42 | return "", ErrInvalid |
| 43 | } |
| 44 | |
| 45 | runtime.LockOSThread() |
| 46 | defer runtime.UnlockOSThread() |
| 47 | |
| 48 | var buf C.git_buf |
| 49 | |
| 50 | ecode := C.git_patch_to_buf(&buf, patch.ptr) |
| 51 | runtime.KeepAlive(patch) |
| 52 | if ecode < 0 { |
| 53 | return "", MakeGitError(ecode) |
| 54 | } |
| 55 | defer C.git_buf_dispose(&buf) |
| 56 | |
| 57 | return C.GoString(buf.ptr), nil |
| 58 | } |
| 59 | |
| 60 | func toPointer(data []byte) (ptr unsafe.Pointer) { |
| 61 | if len(data) > 0 { |
nothing calls this directly
no test coverage detected