Exemplo n.º 1
0
func (repo *Repository) LookupReference(name string) (*Reference, error) {
	ref := new(Reference)
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	ecode := C.git_reference_lookup(&ref.git_reference, repo.git_repository, cname)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return ref, nil
}
Exemplo n.º 2
0
func (v *Reference) Lookup(r *Repo, name string) (err error) {
	ecode := C.git_reference_lookup(&v.git_reference, r.git_repo, C.CString(name))
	if ecode < GIT_SUCCESS {
		return LastError()
	}
	if v.git_reference == nil {
		//return os.NewError("Reference Lookup: Failed to look up " + name)
	}
	return
}
Exemplo n.º 3
0
func (v *Repository) LookupReference(name string) (*Reference, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	var ptr *C.git_reference

	ecode := C.git_reference_lookup(&ptr, v.ptr, cname)
	if ecode < 0 {
		return nil, LastError()
	}

	return newReferenceFromC(ptr), nil
}
Exemplo n.º 4
0
func (v *Repository) LookupReference(name string) (*Reference, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	var ptr *C.git_reference

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ecode := C.git_reference_lookup(&ptr, v.ptr, cname)
	if ecode < 0 {
		return nil, MakeGitError(ecode)
	}

	return newReferenceFromC(ptr, v), nil
}