MCPcopy Create free account
hub / github.com/libgit2/git2go / String

Method String

patch.go:40–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (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
60func toPointer(data []byte) (ptr unsafe.Pointer) {
61 if len(data) > 0 {

Callers

nothing calls this directly

Calls 1

MakeGitErrorFunction · 0.85

Tested by

no test coverage detected