예제 #1
0
func (v *Reference) SetTarget(target *Oid, sig *Signature, msg string) (*Reference, error) {
	var ptr *C.git_reference

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	csig, err := sig.toC()
	if err != nil {
		return nil, err
	}
	defer C.git_signature_free(csig)

	var cmsg *C.char
	if msg == "" {
		cmsg = nil
	} else {
		cmsg = C.CString(msg)
		defer C.free(unsafe.Pointer(cmsg))
	}

	ret := C.git_reference_set_target(&ptr, v.ptr, target.toC(), csig, cmsg)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	return newReferenceFromC(ptr, v.repo), nil
}
예제 #2
0
func (ref *Reference) SetTarget(target string) error {
	ctarget := C.CString(target)
	defer C.free(unsafe.Pointer(ctarget))
	ecode := C.git_reference_set_target(ref.git_reference, ctarget)
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
예제 #3
0
파일: git.go 프로젝트: stettberger/go-git
func (v *Reference) SetTarget(target string) (err error) {
	ctarget := C.CString(target)
	defer C.free(unsafe.Pointer(ctarget))
	ecode := C.git_reference_set_target(v.git_reference, ctarget)
	if ecode < GIT_SUCCESS {
		return LastError()
	}
	return nil
}
예제 #4
0
파일: reference.go 프로젝트: pjvds/git2go
func (v *Reference) SetTarget(target *Oid) (*Reference, error) {
	var ptr *C.git_reference

	ret := C.git_reference_set_target(&ptr, v.ptr, target.toC())
	if ret < 0 {
		return nil, LastError()
	}

	return newReferenceFromC(ptr), nil
}