Exemple #1
0
func (repo *Repository) LookupObject(id *Oid, form ObjectType) (*Object, error) {
	obj := new(Object)
	ecode := C.git_object_lookup(&obj.git_object, repo.git_repository, id.git_oid, C.git_otype(form))
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return obj, nil
}
Exemple #2
0
func (v *Repository) lookupType(oid *Oid, t ObjectType) (Object, error) {
	var ptr *C.git_object
	ret := C.git_object_lookup(&ptr, v.ptr, oid.toC(), C.git_otype(t))
	if ret < 0 {
		return nil, LastError()
	}

	return allocObject(ptr), nil
}
Exemple #3
0
func (v *Repository) lookupType(id *Oid, t ObjectType) (Object, error) {
	var ptr *C.git_object

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_object_lookup(&ptr, v.ptr, id.toC(), C.git_otype(t))
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	return allocObject(ptr, v), nil
}