Example #1
0
func (patch *Patch) String() (string, error) {
	if patch.ptr == nil {
		return "", ErrInvalid
	}
	var buf C.git_buf
	ecode := C.git_patch_to_buf(&buf, patch.ptr)
	if ecode < 0 {
		return "", MakeGitError(ecode)
	}
	return C.GoString(buf.ptr), nil
}
Example #2
0
File: patch.go Project: wid/git2go
func (patch *Patch) String() (string, error) {
	if patch.ptr == nil {
		return "", ErrInvalid
	}
	var buf C.git_buf

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ecode := C.git_patch_to_buf(&buf, patch.ptr)
	if ecode < 0 {
		return "", MakeGitError(ecode)
	}
	return C.GoString(buf.ptr), nil
}