Пример #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
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
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
}