Exemple #1
0
func (repo *Repository) LookupObjectPrefix(id *Oid, n uint, form ObjectType) (*Object, error) {
	obj := new(Object)
	ecode := C.git_object_lookup_prefix(&obj.git_object, repo.git_repository, id.git_oid, C.uint(n), C.git_otype(form))
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return obj, nil
}
Exemple #2
0
func (r Repository) LookupObject(id string) (*Object, error) {
	o := new(Object)
	oid, err := NewOidFromString(id)
	if err != nil {
		return nil, err
	}
	if err := gitError(C.git_object_lookup_prefix(&o.obj, r.repo, oid.oid, C.uint(len(id)), _GIT_OBJ_ANY)); err != nil {
		return nil, err
	}
	return o, nil
}