Пример #1
0
func NewOidString(s string) (*Oid, error) {
	o := &Oid{new(C.git_oid)}
	cs := C.CString(s)
	defer C.free(unsafe.Pointer(cs))
	if C.git_oid_fromstr(o.git_oid, cs) < GIT_SUCCESS {
		return nil, LastError()
	}
	return o, nil
}
Пример #2
0
func NewOidFromString(s string) (*Oid, error) {
	o := new(Oid)
	cs := C.CString(s)
	defer C.free(unsafe.Pointer(cs))

	if C.git_oid_fromstr(o.toC(), cs) < 0 {
		return nil, LastError()
	}

	return o, nil
}