Exemplo n.º 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
}
Exemplo n.º 2
0
Arquivo: git.go Projeto: pjvds/git2go
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
}