Beispiel #1
0
func (v *Reference) SetSymbolicTarget(target string, sig *Signature, msg string) (*Reference, error) {
	var ptr *C.git_reference

	ctarget := C.CString(target)
	defer C.free(unsafe.Pointer(ctarget))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	csig := sig.toC()
	defer C.free(unsafe.Pointer(csig))

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

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

	return newReferenceFromC(ptr), nil
}
Beispiel #2
0
func (v *Reference) SetSymbolicTarget(target string) (*Reference, error) {
	var ptr *C.git_reference
	ctarget := C.CString(target)
	defer C.free(unsafe.Pointer(ctarget))

	ret := C.git_reference_symbolic_set_target(&ptr, v.ptr, ctarget)
	if ret < 0 {
		return nil, LastError()
	}

	return newReferenceFromC(ptr), nil
}